SED Cheatsheet

bash

 

Some useful cheatsheet for sed:-

sed ‘2d’ file.txt Remove second line from file.txt
sed ‘/mickgenie/d’ file.txt Remove the line containing the word/string mickgenie from file.txt
sed ‘$d’ file.txt Remove last line from file.txt
sed ‘/^$/d’ file.txt Remove empty line from file.txt
sed ‘1,5d’ file.txt Remove line between 1 and 5 from file.txt

Published by

Mick Genie

Mick Genie is the founder of MickGenie.com and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.