sed question

Rob DeSanno rdesanno at gmail.com
Fri Aug 19 18:06:30 UTC 2011


I'm trying to use sed to parse the below data into html and was hoping that
someone in this group could point me in the right direction.

What I am trying to do is to change the "-" character to something else ONLY
when it is next to a number [0-9]. What makes this a challenge for me is
that it can also exist next to a letter but never more than once next to a
number.

The line I am using is below and works fine for what I need expect that the
first digit of the number at the end is cut off in the table I am trying to
build.

'102.1'>Columbus-612
'104.1'>Fredericksburg-628
'108.1'>Garden-Grove-736
'101.1'>Mission-Viejo-1514
'104.1'>Fort-Worth-418
'1030.1'>Ft.-Lauderdale-304
'1050.1'>Hamilton-713

sed -e "s/^'/\<tr\>\<td\>/" $stores_down | sed -e "s/'>/\<\/td\>\<td\>/" | *sed
-e "s/-[0-9]/\<\/td\>\<td\>/"* | sed -e "s/$/\<\/td\>\<\/tr\>/" >> $log

Any suggestions?

Thanks in advance!
~Rob



More information about the redhat-list mailing list