Regular Expression Puzzle
Ray Parrish
crp at cmc.net
Sun Nov 29 13:37:59 UTC 2009
Alan McKay wrote:
> Dude, that's a bit of a convoluted way to go about it.
>
> How about keeping it simple?
>
> cat file | sed "s/<div>/<p>/g" | sed "s/<\/div>/<\/p>/g" > newfile
>
Hello,
I tried that command, and it does indeed change the <div>'s to <p>'s,
but it does it across the entire file, and I do not want to replace
every <div> in the file with paragraph tags.
I need the ability to change certain blocks of text that are similar but
different in different files, and I would like a command that handles
all variations on the basic theme of it starts with a certain string,
varies in the middle, then is the same on the end of the string again.
Those sample lines iI provided are from the navigation links I put at
the top of all of my web pages, and it would be nice to do a broadcast
change to update, or change their appearance instead pf having to edit
every single file by hand, which takes hours.
Well, I'm back to reading up on regular exprssions to see if there is
some possible way to make a broadcast change through all of my pages to
change the appearance of the navigation links.
Later, Ray Parrish
--
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list