[nSLUG] sed question

Herb htheriault at gmail.com
Wed Dec 28 20:34:16 AST 2005


Thanks, that works out perfectly. Now I'm off to start learning awk :)

-Herb




On 12/28/05, Stephen Gregory <nslug at kernelpanic.ca> wrote:
> On Wed, Dec 28, 2005 at 07:16:27PM -0400, Herb wrote:
>
> > couple of more complex ones. There are lines that have chunks that
> > need removing while keeping other chunks.
> >
> > EMAIL: address at here remove these bits
>
> try awk:
>
> awk ' /^EMAIL:/ { print $1 " " $2 }' < infile > outfile
>
>
> If you want to keep the other lines in the file that do no start with
> "EMAIL" try:
>
> awk ' /^EMAIL:/ { print $1 " " $2 }   !/^EMAIL/ { print }'
>
>
> While sed is good I have found awk to be better. Most problems solved
> with sed can be solved with awk just as easily. It is still good to
> know sed syntax as the vi/vim ex mode (: mode) syntax is similar.
>
> --
> sg
>
>
>
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug
>
> 
>
>


--
--------
Herb Theriault
http://www.electronictea.com

!DSPAM:43b32f09267561687615693!




More information about the nSLUG mailing list