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
Post a Comment