Unix Shell - Re: SED question: entering a blank line above a character searched

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > December 2007 > Re: SED question: entering a blank line above a character searched





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: SED question: entering a blank line above a character searched
Ed Morton

2007-12-28, 1:26 pm



On 12/28/2007 1:01 AM, Kompu Kid wrote:
> Hello All:
>
> After finding a ":", I would like to enter a blank line above the line
> that the colon is found.
>
> How do I do this with SED?


Appologies if there's some reason you NEED to use sed, but often people request
a solution with one tool because they don't know the alternatives. In this case:

awk '/:/{print ""}1' file

In general sed should only be used for simple substitutions.

Ed.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com