Chris Arnold wrote:
Open the file in Kate and do a search and replace on the string indexFRMB01C001 and replace it with indexFRMB01C002
I don't need to do a "replace". I need to add some text before the 
indexFRMB01C00?

Oh, sorry I went straight to the script and didn't read your message very well. To do this, use the sed command
sed --in-place= -e "s/\(\/[^\.\/]*\)\(\.htm\)/\1YOURTEXT\2/" "$target"

this assumes no lines end in the middle of your HREF filenames. Replace YOURTEXT with what you want.

--Jason
On Dec 10, 2007, at 3:54 PM, Chris Arnold wrote:

Using SLED SP1 and SED. I need to add some text before some existing text in 1 file, in about 100 different spots. The existing text is as follows: <A onclick="window.open(this.href,'_blank');return false;" HREF='/ kjvdict/indexFRMB01C001.htm'>1</A>

The section of text above will differ in every line. So the section indexFRMB01C001 will appear as indexFRMB01C002 on the next line and so on for all 100 lines. Randall S wrote a killer script that would add quotes to some text so i am trying to modify that script and use it but not having much luck. Here is the script:

#!/bin/sh
targetList=(




   # ... or "ls":
       $( ls *.php )
)

for target in "[EMAIL PROTECTED]"; do

   sed \
       --in-place= \
       -e "1s;*.htm;'&';" \
       "$target"

done

You can see that i am trying to use a wildcard in *.htm......Clearly, i don't know what i am doing :) Can someone (nicely) help me with this?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to