sed 10q demo.txt
- prints first 10 lines
sed -i'.bak' 's/hello/bar/' demo.txt
- replace the first "hello" on each line with "bar"
sed -i'.bak' 's/hello/bar/g' demo.txt
- replace the ALL "hello" on each line with "bar"
sed -i'.bak' '3d' demo.txt
- remove the 3rd line in a file