2025-01-10 10:42:27 +05:30
|
|
|
## OS Lab - Week2
|
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
Q2. (* finds all the files in the folder with exactly two characters)
|
|
|
|
```bash
|
|
|
|
grep -E '^..$' *
|
|
|
|
grep '^[A-Z]' *
|
|
|
|
grep '\.$' *
|
|
|
|
grep ' ' *
|
|
|
|
grep '[0-9]' filename > outputfile
|
|
|
|
```
|
2025-01-10 10:42:27 +05:30
|
|
|
|
2025-01-14 15:13:53 +05:30
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
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
|
|
|
|
```
|
2025-01-10 10:42:27 +05:30
|
|
|
|
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
Q4.
|
|
|
|
```bash
|
|
|
|
grep -rl "MIT" . | xargs sed -i 's/MIT/Manipal Institute of Technology/g'
|
|
|
|
```
|
2025-01-10 10:42:27 +05:30
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
Q5.
|
2025-01-14 15:13:53 +05:30
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
```bash
|
|
|
|
find . -type f -name '*[0-9]*' -exec wc {} +
|
|
|
|
```
|
2025-01-10 10:42:27 +05:30
|
|
|
|
2025-01-14 15:13:53 +05:30
|
|
|
|
2025-01-14 15:17:50 +05:30
|
|
|
Q6.
|
|
|
|
```bash
|
|
|
|
for i in {1..5}; do wc example.txt & done
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2025-01-14 15:18:08 +05:30
|
|
|
pkill wc
|
2025-01-14 15:17:50 +05:30
|
|
|
```
|