[Top][All Lists]

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

Re: Insert conditional newline if line 7 NEQ "B"

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

sed "7 s/^[^B].*/\n&/"
did the trick, very nicely, thanks to a gent from Germany in another

On Mar 10, 1:16 pm, John Bartley K7AAY <> wrote:
> 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]