Hi guys, I'm looking for some thoughts on this. I'm trying to do a clean 1 liner to substitute some values. What I have:
sed 's/Personid=.*/Personid=xxxxxx/' $tmpFileOut
sed 's/Person:.*/Person:xxxxxx/' $tmpFileOut
sed 's/PersonID:.*/PersonID: xxxxxx/' $tmpFileOut
Obviously that's a bit sucky, I'm repeating 3 lines which are all basically doing the same thing. I want to smarten it up. The thing they all have in common is that I'm looking for 'Person' and whatever is after that, and substituting it. Is there a cleaner way to do the above in one go?
Perl - I'm doing a substitution like this:
perl -pe 's/(?<![a-z])dog(?![a-z])/cat/g' $tmpFileOut
perl -pe 's/(?<![a-z])green(?![a-z])/blue/g' $tmpFileOut
again, I'm repeating lines - what's a cleaner way to do this in perl? I have like 15 lines of substitions, I'd like it short and sweet - what's the best way to do it? Put all substitions onto one line? how would I do that? or would some kind of array be the best way to do it?
Help/thoughts appreciated