[plug] Need help with sed

Daniel Pittman daniel at rimspace.net
Mon Aug 3 13:16:13 WST 2009


"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
-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons



More information about the plug mailing list