sed, using line number to replace text
- From: "peter_sands@xxxxxxxxxxxxx" <peter_sands@xxxxxxxxxxxxx>
- Date: 20 Nov 2006 12:03:32 -0800
Hi,
I am converting a .csv file into an HTML file, all looks good apart
from one little problem. I need to make some sed inserts ( well I think
sed will do it ),
For every occurance of the word 'CLAIMS', within that line there is an
amount figure. I need to make that number bold as well, so I need to
insert a <B>, before the number. Using 'grep -n ' I can extract the
line numbers, see below:
183:<TR ALIGN=CENTER><TH>33003</TH><TD><B>CLAIMS
EUC</B></TD><TD></TD><TD>
</TD><TD></TD><TD></TD><TD></TD><TD></TD><TD>21781</TD>
340:<TR ALIGN=CENTER><TH>33003</TH><TD><B>CLAIMS
EUX</B></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD>7892</TD>
But how can I in sed use that line number , to change insert a tag.
What I need to end up with is something like... <B>7892</B>, like so::
<TR ALIGN=CENTER><TH>33003</TH><TD><B>CLAIMS EUX</B></TD><TD></TD><TD
</TD><TD></TD><TD></TD><TD></TD><TD></TD><TD><B>7892</B></TD>Or is there a better way of doing it.
Thanks
Pete
.
- Follow-Ups:
- Re: sed, using line number to replace text
- From: Radoulov, Dimitre
- Re: sed, using line number to replace text
- From: Chris F.A. Johnson
- Re: sed, using line number to replace text
- Prev by Date: Re: Newbie Sed Question.
- Next by Date: Re: sed, using line number to replace text
- Previous by thread: Rsync --exclude option
- Next by thread: Re: sed, using line number to replace text
- Index(es):
Relevant Pages
|