#Delete empty lines from a file
sed '/^$/d' file.txt
# do the same in the source file itself
sed -i '/^$/d' file.txt
# copy contents from a file from 3rd line
sed -n '3,$p' file.txt
#copy specific lines from a file(e.g. copy line 2 to 4)
sed -n 2,4'p' file.txt
sed '/^$/d' file.txt
# do the same in the source file itself
sed -i '/^$/d' file.txt
# copy contents from a file from 3rd line
sed -n '3,$p' file.txt
#copy specific lines from a file(e.g. copy line 2 to 4)
sed -n 2,4'p' file.txt
Comments