-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Use the filtering built in to awk instead.
$> cat file.txt | sed '/^$/d'
can be done as:
$> cat file.txt | awk '$0!~/^$/ {print $0}'
(i.e. if the whole line is not empty, print the whole line)
That way you can get rid of sed, and put the whole awk program into a file, add any additional conditions for which lines to care about or ignore, format the code nicely and use it as an arg to awk:
$> cat file.txt | awk -f print_non-empty_lines.awk
Thankyou robinsp for pointing it out.
Metadata
Metadata
Assignees
Labels
No labels