Code ETCS-307 LINUX AND X WINDOWS PROGRAMMING – Assignment IV Question1: What happens when you use grep a b c? Ans: grep searches for a from file b and c Display the files in the current directory that contain the string A HREF in either uppercase or lowercase. Ans: grep href’ * –li “a Can you use to display lines containing pattern and five grep <TABLE> lines below? Ans: grep 5 filename –A “<TABLE> What does expression specify? gg* Ans: one or more occurrences of g How do you locate the lines containing and using harris Harrison grep? Ans: grep –i “harris*n*” What will the regular expression match? a. *b Ans: The longest pattern starting with a and ending with b, as close to the left of the line as possible. How can locate lines longer than 15 characters? State two ways. grep Ans: grep filename (16 dots) “…………….” Or grep filename “.\{16\}” If you do not have command, how would you use to count the wc grep number of users currently using your system? Ans: who | grep –c “” How would you remove blank lines from a file using grep? Ans: grep filename –v –e ‘^$’
Code – ETCS-307 LINUX AND X WINDOWS PROGRAMMING Assignment IV Question1: What happens when you use grep a b c? Ans: grep searches for a from file b and c Display the files in the current directory that contain the string A HREF in either uppercase or lowercase. Ans: grep –li “a href’ * Can you use grep to display lines containing pattern <TABLE> and five lines below? Ans: grep –A 5 “<TABLE> filename What does expression gg* specify? Ans: one or more occurrences of g How do you locate the lines containing harris and Harrison using grep? Ans: grep –i “harris*n*” What will the regular expression a. *b match? Ans: The longest pattern starting with a and ending with b, as close to the left of the line as possible. How can grep locate lines longer than 15 characters? State two ways. Ans: grep “…………….” filename (16 dots) Or grep “.\{16\}” filename If you do not have wc command, how would you use grep to count the number of users currently using your system? Ans: who | grep –c “” How would you remove blank lines from a file using grep? Ans: grep –v –e ‘^$’ filename
Assignment%20IV.docx