How to remove empty lines from a file:
sed '/^$/d' file.txt
Remove commented lines from a specific file
sed 's/^#.*//' file.txt
Above command will replace # 'ed lines by empty lines, in case we want to merge both steps into a single command, we'll issue the following command.
sed -e 's/^#.*//;/^$/d' file.txt
sed '/^$/d' file.txt
Remove commented lines from a specific file
sed 's/^#.*//' file.txt
Above command will replace # 'ed lines by empty lines, in case we want to merge both steps into a single command, we'll issue the following command.
sed -e 's/^#.*//;/^$/d' file.txt
Cap comentari:
Publica un comentari a l'entrada