[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Insert conditional newline if line 7 NEQ "B"

From: John Bartley K7AAY
Subject: Insert conditional newline if line 7 NEQ "B"
Date: Mon, 10 Mar 2008 13:16:13 -0700 (PDT)
User-agent: G2/1.0

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]