sed script - remove tabs at begin of line

Where Penguins and Daemons chill together in the warmth of the Sun.

Moderators: SecretSquirrel, notfred

sed script - remove tabs at begin of line

Postposted on Tue Apr 21, 2009 8:47 pm

Alright gurus, I am trying to remove tab spaces from the beginnings of lines in a file. Here's how I'm trying to do it:

sed -e '/^\t*/d' infile > outfile

It results in an empty output file. What am I screwing up?
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: sed script - remove tabs at begin of line

Postposted on Tue Apr 21, 2009 8:57 pm

You're deleting all of those lines that match the expression "^\t*" -- a line beginning with 0 or more tabs.

I'd do:
sed -e 's/^\t*//' (substitute the leading tab(s) with nothing)
bitvector
Grand Gerbil Poohbah
 
Posts: 3234
Joined: Wed Jun 22, 2005 4:39 pm
Location: Mountain View, CA

Re: sed script - remove tabs at begin of line

Postposted on Tue Apr 21, 2009 9:00 pm

LOL. Thanks BV.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH

Re: sed script - remove tabs at begin of line

Postposted on Tue Apr 21, 2009 9:01 pm

Heh, yep, that did the trick.
flip-mode
Gerbil Khan
Silver subscriber
 
 
Posts: 9084
Joined: Thu May 08, 2003 12:42 pm
Location: Cincinnati, OH


Return to Linux, Unix, and Assorted Madness

Who is online

Users browsing this forum: No registered users and 3 guests