From 4a33716a496ea60024e18f5a85d156388db03c2d Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Fri, 10 Jan 2025 10:42:27 +0530 Subject: [PATCH] Upload files to "OS/bash/Week2" --- OS/bash/Week2/answers.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 OS/bash/Week2/answers.md diff --git a/OS/bash/Week2/answers.md b/OS/bash/Week2/answers.md new file mode 100644 index 0000000..b3932ce --- /dev/null +++ b/OS/bash/Week2/answers.md @@ -0,0 +1,21 @@ +## OS Lab - Week2 + +Q2. + - `grep -E '^..$' *` (finds all the files in the folder with exactly two characters) + - `grep '^[A-Z]' *` + - `grep '\.$' *` + - `grep ' ' *` + - `grep '[0-9]' filename > outputfile` + +Q3. - `grep -c "ICT" ITStudents.txt` + - `sed 's/:IT:/:Information Technology:/g' students.txt > ITStudents.txt` + - `sed awk -F: '$1 == "1234" { avg = ($6 + $7 + $8) / 3; print avg }' students.txt` + - `awk 'NR==1 { print toupper($0) } NR>1 { print }' students.txt` + + +Q4. - `grep "MIT" * | sed 's/MIT/Manipal Institute of Technology/g' | cut -d':' -f1,2` + +Q5. - `find . -type f -name '*[0-9]*' -exec wc {} +` + +Q6. - `for i in {1..5}; do wc example.txt & done` + - `pkill wc`