[nylug-talk] need sed help

jh jhlists at hirschman.net
Tue Apr 3 12:24:15 EDT 2007


Ajai Khattri wrote:
> On Tue, 3 Apr 2007, 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
> 
> 
> http://sed.sourceforge.net/sedfaq3.html#s3.2
> 
> 
Shouldn't this work?

sed -e 's/^[\x20]*//1' problem.txt > out.txt

This works to remove all spaces:

sed -e 's/[\x20]*//g'

What am I doing wrong?

jh


More information about the nylug-talk mailing list