GTU OS Program - 11 Filters
11. Shell programming using filters (including grep, egrep, fgrep). The programs that take plain text as standard input and transforms it into a meaningful format, and then returns it as a standard output is known as Filters. Some of the most commonly used filters are explained below: cat head tail sort uniq wc grep tac sed nl 1. cat: Displays the text of the file line by line. Syntax cat [path] Output 2. head: Displays the first n lines of the specified text files. If the number of lines is not specified then by default prints first 10 lines. Syntax head [-number_of_lines_to_print] [path] Output 3. tail: It works the same way as head, but in reverse order. It returns the lines from bottom to up Syntax tail [-number_of_lines_to_print] [path] Output 4. sort: sorts the lines alphabetically by default but we can customize the ...
Comments