sed, awk, grep
1. Print 1-6 range of lines with p cat demo.txt | sed -n '1, 6p' 2. Print Except 4,9 lines with d cat demo.txt | sed -n '6, 10d' 3. Print all non consecutive lines cat demo.txt | sed -n -e '6, 10p' -e '10, 13p' 3.replace string golbal cat demo.txt | sed "s/oldword/newword/g" Igonre character case cat demo.txt | sed "s/oldword/newword/gi" 4. Replace blank space cat demo.txt | sed -n 's/ */ /g' 5. Replace in b/w 4,9 lines cat demo.txt | sed -n '10,15 s/oldwrd/new/g' 6. Delete 4,9 lines with d cat demo.txt | sed -n '6, 10d' 7. Other 4,9 Delete another lines with d & n cat demo.txt | sed -n '6, 10!d' Example :1) Displaying partial text of a file With sed, we can view only some part of a file rather than seeing whole file. To see some lines of the file, use the following command, [linuxtechi@localhost ~]$ sed -n 22,29p testfile.txt here, option ‘n’ suppresses printing of whole file & option ‘p’ wi...