[nycbug-talk] Re: Simple sed question

George Georgalis george
Fri Jan 7 13:56:15 EST 2005


On Fri, Jan 07, 2005 at 01:31:21PM -0500, francisco at natserv.com wrote:
>On Fri, 7 Jan 2005, George Georgalis wrote:
>
>>>507     AllianceBer Intl PremGr C     AIPCX   8.29    -2.24   -1.54
>>>508     AllianceBer Intl PremGrAd     AIPYX   8.87    -1.88   -0.67
>>>509     AllianceBer Intl Val A        ABIAX   14.91   5.59    9.79
>>>510  AllianceBer Intl Val A    ABIAX   14.91   5.59    9.79
>>>511 AllianceBer Intl Val A    ABIAX   14.91   5.59    9.79
>>>512 AllianceBer Intl Val A    ABIAX   14.91   5.59    9.79
>>
>>s/[ \t]*/\t/g
>>substitute, any combination of spaces and tabs with one tab character,
>>globaly across the line (untested)
>
>I don't think that's what I am looking for.
>If you substitute spaces by a tab then the spaces inside the description 
>will be made into tab. For example "AllianceBer Intl PremGr C" should 
>remain with it's spaces.
>

That problem occured to me after I sent the message, I don't really know
what constitutes columns... neither does sed, I'd do additional passes
for additional cleanup.

sed -e '
	s/[ \t]*/\t/g
	s/AllianceBer.Intl.Val./AllianceBer Intl Val /
	s/AllianceBer.Intl.PremGrAd/AllianceBer Intl PremGrAd/
	s/AllianceBer.Intl.PremGr/AllianceBer Intl PremGr /
	' >outfile <infile

// George


-- 
George Georgalis, systems architect, administrator Linux BSD IXOYE
http://galis.org/george/ cell:646-331-2027 mailto:george at galis.org




More information about the talk mailing list