[nylug-talk] need sed help

Peter C. Norton spacey-nylug at lenin.net
Tue Apr 3 12:42:58 EDT 2007


The preceeding 1 of the pattern indicates that it should only happen
on the first line.

The ^ is at the beginning of the line.

The [ \t] groups the space and the tab.

The * is one or more ofr the preceeding character or group.

-Peter

On Tue, Apr 03, 2007 at 12:28:54PM -0400, jh wrote:
> Works like a charm. Thanks. Can you explain the syntax to me? Would very 
> much appreciate it.
> 
> jh
> 
> Peter C. Norton wrote:
> > Does this not work for you?
> > 
> > gnu sed '1s/^[ \t]*//'
> > 
> > -Peter
> > 
> > On Tue, Apr 03, 2007 at 12:09:42PM -0400, jh wrote:
> >> I'm trying to use sed to delete all the whitespace, up to the first 
> >> non-white character, on the first line of a file, and I can't make it 
> >> work. Can someone show me what will work?
> >>
> >> Tried this:
> >>
> >> sed -e 's/[\t]//1' problem.txt > out.txt
> >> sed -e 's/[\020]*//1' problem.txt > out.txt
> >> sed -e 's/[:space:]*//1' problem.txt > out.txt
> >>
> >> No dice. This is on an MS-DOS formatted text file...
> >>
> >> Thanks~
> >>
> >> jh
> >>
> >> _____________________________________________________________________________
> >> Hire expert Linux talent by posting jobs here :: http://jobs.nylug.org
> >> The nylug-talk mailing list is at nylug-talk at nylug.org
> >> The list archive is at http://nylug.org/pipermail/nylug-talk
> >> To subscribe or unsubscribe: http://nylug.org/mailman/listinfo/nylug-talk
> > 
> 
> _____________________________________________________________________________
> Hire expert Linux talent by posting jobs here :: http://jobs.nylug.org
> The nylug-talk mailing list is at nylug-talk at nylug.org
> The list archive is at http://nylug.org/pipermail/nylug-talk
> To subscribe or unsubscribe: http://nylug.org/mailman/listinfo/nylug-talk

-- 
The 5 year plan:
In five years we'll make up another plan.
Or just re-use this one.



More information about the nylug-talk mailing list