Time Sensitive Linux Introductory Shell Scripting Focusing o
[Time Sensitive] Linux Introductory Shell Scripting (Focusing on SED & AWK)
1)
Part A:
a- Show all lines that have only the word hello in file file1.
b- Show all lines that have at least five characters.
c- Show all lines that have only 5 digits.
d- Write the command to find out the number of words in the file file1.
e- Write the command to substitute all the words Unix to Linux in a file called file1.
f- Write the command to rename the file file1 to file2.
g- Write the command to list only the directories in the current folder.
h- Use the sed command to print lines 6 to 10. Modify that command to place lines 6 to 10 of file1 into file2.
i- Write a script to read three numbers and find the sum of these numbers. Find the largest number. Display the largest number and the sum.
Solution
As per chegg policy i will aswer of top 3 few questions.
1) grep -i \'hello.*world\' abc.txt abc1.txt Desc- lists all the line with hello world in it.
2) grep -r \'.\\{5\\}\' /path | grep \'if\'
3) awk \'length($1) == 5\' file1
4) wc -w <file>
6) sed -ie \'s/Unix/linux/g\' hello.txt
![[Time Sensitive] Linux Introductory Shell Scripting (Focusing on SED & AWK) 1) Part A: a- Show all lines that have only the word hello in file file1. b- Sho [Time Sensitive] Linux Introductory Shell Scripting (Focusing on SED & AWK) 1) Part A: a- Show all lines that have only the word hello in file file1. b- Sho](/WebImages/36/time-sensitive-linux-introductory-shell-scripting-focusing-o-1107411-1761586424-0.webp)