[plug] Need help with sed

Arie Hol arie99 at ozemail.com.au
Mon Aug 3 14:50:25 WST 2009



On 3 Aug 2009 at 15:16, Daniel Pittman wrote:

> "Arie Hol" <arie99 at ozemail.com.au> writes:
> 
> > I am currently processing a large number of files using sed;
> > I am running sed as a series of commands from a shell script
> >
> > The problem I have is :
> >
> > sed is leaving "blank" lines where it removes the 'target text' - many of
> > these blank lines contain tabs and spaces (whitespace).
> >
> > I can remove some of the  whitespace but I still end up with blank lines.
> >
> > Is there a sed command I can use to remove any/all lines which appear to 
> > only have whitespace or are just blank lines?
> 
>     /^[[:space:]]*$/d
> 
> Less succinctly, 'anything matching a line that contains only whitespace
> characters', 'delete this line'.
> 
> Regards,
>         Daniel

Many Thanks to Daniel & Carl for the help given with sed commands.

You guys were right on the money ..... cheers.

I obviously  did not know about the /d switch being used on its own. I 
was mistakenly appending the /d option at the end of a regex which 
started with a s/ option --------- result being a blank file.

I am now a wiser person thanks to Daniel & Carl

Regards Arie
------------------------------------------------------------------
 For the concert of life, nobody has a program.
------------------------------------------------------------------
-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.42/2278 - Release Date: 08/02/09 17:56:00


More information about the plug mailing list