Ok, so I've started down a lonesome road where I'm trying to learn the language of the locals, but it's really difficult. The biggest difficulty I'm finding is the pace at which the tutorials I've found move, anyway, onto my questions.
I'm learning how to replace text using sed. I've been practicing on both practice files (so I don't completely dork a system) and real files (once I see how the stuff works on the practice files). It's going pretty good, but now I'm venturing into new territory, regex.
I can't find a howto over at http://www.tldp.org
on regex, and so far the most helpful thing was the LQ Wiki entry for it. But, as with most of what I've found, it jumps quickly into the lingo that I don't quite follow, yet...
This time it's with Bugzilla. I'm setting up a new Bugzilla setup, and I don't much care for some of the wording. They have a really "neat" way of using text replacement for terms you don't like, and the default includes replacing words like "bug" with whatever you want, in my case I chose "problem". This is all setup already, and all I had to do was go into the variables file and change the word bug to problem, save and close, and BAM! all instances of bug are replaced with problem. Pretty neat! The way they do this is using a sequence like so:
[% terms.bug %] And then anywhere "bug" would normally be my new word (problem) shows up.
Ok, so now I have some words that aren't in that file, so I've setup a variable in the file for Product. Yet none of the pages have the special sequence [% terms.Product %] in them for that term. So I thought I could use sed and regex to weed out and change my needs easily.
All of that for this:
How can I do this? (I'd also love a crawling tutorial that crawls with me through learning this if anyone has one).
So far, I did this:
find . -type f -true | xargs -n1 sed -i 's/product/[% terms.product %]/g'
And it worked fairly good. It made a couple of errors that I had to manually fix, like placing that inside another variable [% some-other_variable [% terms.product %] modifier %] I'd have to go in and hard code my replacment (location is my replacement in the variable file).
So, any ideas on how I can avoid replacing the terms inside an existing variable?
If any of that doesn't make sense, please respond and I'll see if I can clarify a bit.
Later on that hour:
It just occurred to me that I don't have to use Bugzilla's variable replacement to replace my text, I can just do it with sed and not have to worry about changing it again...
I'm still interested in a response to my above problem even though I won't be using it in this situation.