-
cjcox
-
RE: Aargh.. can't figure this out: for( i in s), index
-
Not sure Bill... but I didn't find your description of what you're trying to do to be clear at all.
Do you have a file of replacement text that looks like:
word;newword
word2;newword2
word3;newword3
etc...
I think that's what you're saying.
But on replace, you want the string replaced with the line number preceding of the line from the file of keyword/replace pairs?
Sometimes, you need to look at things from a different perspective... assume the keyword file is called repl.txt, then consider:
grep -n '.' repl.txt | sed 's,^\([0-9]*\):\([^;]*\);\([^;]*\),s/\\\b\2\\\b/\1 \3/g,' >repl.sed
The sed script file now contains substitute commands for your keyword replaces, so you could call it like:
sed -f repl.sed myhtmlfile.html
I'm hoping that's useful.... but maybe I'm way off.
-
13 Jul 10
Not sure Bill... but I didn't find your description of what you're trying to do to be clear at all.
Do you have a file of replacement text that looks like:
word;newword
word2;newword2
word3;newword3
etc...
I think that's what you're saying.
But on replace, you want the string replaced with the line number preceding of the line from the file of keyword/replace pairs?
Sometimes, you need to look at things from a different perspective... assume the keyword file is called repl.txt, then consider:
grep -n '.' repl.txt | sed 's,^\([0-9]*\):\([^;]*\);\([^;]*\),s/\\\b\2\\\b/\1 \3/g,' >repl.sed
The sed script file now contains substitute commands for your keyword replaces, so you could call it like:
sed -f repl.sed myhtmlfile.html
I'm hoping that's useful.... but maybe I'm way off.