first middle last
other line
other line
f last
line line
line
first M last
line line
line
(so in this case first and last par have three fields and middle par
has two fields)
I believe it's possible (with awk or sed) to delete paragraphs
depending on first line. eg: delete all par with 2 fields in first
line of paragraph. thank for any help.
Untested:
awk -v RS= -F'\n' 'split($1,a)!=2' file
Ed.
when i do !=3 it leaves paragraphs with 3 fields in first line and
deletes 2-fields paragraphs but when i do !=2 it leaves both types of
paragraphs (with 2 and 3 fields in first line of par). i may need to
do more testing.
Also command deletes spaces between paragraphs and i need to preserve
spaces.
thanks
You may have trailing white space on each line.
> Also command deletes spaces between paragraphs and i need to preserve
> spaces.
> thanks
Add .... -v ORS="\n\n" ...
Ed.
awk -v RS= -F'\n' -v ORS="\n\n" 'split($1,a,"[[:space:]]+")!=3'
(i had to del trailing white spaces)