Insert conditional newline if line 7 NEQ "B"
John Bartley K7AAY <[email protected]>
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <c6b58937-84f4-4734-8105-826d80a83a88@s37g2000prg.googlegroups.com> |
Kinda terse, yeah.. Here's what I hope you can help me with.
I have a series of hundreds of small (10-15 line) text files.
I need to check line 7.
If it does NOT begin with B, insert a newline.
If it does begin with B, don't do anything.
awk "NR==7 && substr($0,1,1)!="B" {print""} " %1.b
was suggested (elsewhere) but that duplicates line 7 instead of just
stuffing in a newline.
I've tried multiple variations on sed "7,1 s/" to no avail.
Help me, Obi Wan-Kenobi, you're my only hope.
Thank you kindly.