# sed -i '2 d' file.txt --- Delete the 2nd line from file and save
# sed -i 's/Word to Repace/New Word/g' file.txt ---> Replace a word or Line in the file and save
# sed '1,4d' test.txt --- To delete from line 1,4
# sed '/^$/d' test.txt --- To delete blank lines
# sed -i 's/Today/TODAY/g' test.txt --- To replace the word "Today" to "TODAY" and save the file in all lines
# cat /etc/passwd | sed -n '1,3p' --- To Print lines 1 to 3
# cat /etc/passwd | sed 's:/root:/user1:g' --- Alternative String Separator
# cat testing | sed '/^daemon/d' --- matches all the lines starting with daemon and then deleting them
# cat testing | sed '/sh$/d' --- Delete all the lines ending with sh
To Replace Line starting with word " filter" to "filter = [ "a/sdx/", "r/.*/"
# echo -en "\e[1;96m Enter LVM-HDD Name \e[0m ( Like sdb or xvdb ) : " ; read lvm_hdd
# sed -i "/^ filter/s/filter.*/filter = [ \"a\/$lvm_hdd\/\", \"r\/.*\/\" ]/g" /etc/lvm/lvm.conf
# grep filter /tmp/lvm.confs