regex - Remove everything starting from the first blank line in a text file -


i have text file want remove lines beginning first blank line, preferably using standard unix tool sed/awk.

this should work:

awk '/^$/ {exit}{print}' < data 

sample input:

one 2 thre 4 5 6 7  8 9 ten eleven twelve thirteen  fourteen fifteen end 

sample output:

# awk '/^$/ {exit}{print}' < data 1 2 thre 4 5 6 7 

btw, if "blank lines" include spaces and/or tabs, use:

'/^[ \t]*$/ {exit}{print}' 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -