troubleshooting Question

find replace in file

Avatar of Vlearns
Vlearns asked on
PerlRegular ExpressionsScripting Languages
3 Comments1 Solution379 ViewsLast Modified:
sample.txt

PERM = 444
OWNER = root
GROUP = wheel

f - - - share/htdocs/include/ar/mail/taglines/taglines.xml ar/taglines.xml
f - - - share/htdocs/include/au/mail/taglines/taglines.xml au/taglines.xml
f - - - share/htdocs/include/b5/mail/taglines/taglines.xml b5/taglines.xml
f - - - share/htdocs/include/br/mail/taglines/taglines.xml br/taglines.xml
f - - - share/htdocs/include/ca/mail/taglines/taglines.xml ca/taglines.xml
f - - - share/htdocs/include/cf/mail/taglines/taglines.xml cf/taglines.xml
f - - - share/htdocs/include/cn/mail/taglines/taglines.xml cn/taglines.xml
f - - - share/htdocs/include/de/mail/taglines/taglines.xml de/taglines.xml


result.txt

PERM = 444
OWNER = root
GROUP = wheel

f - - - share/htdocs/include/ar/mail/taglines/taglines.xml ../trunk/aa/mail/taglines/taglines.xml
f - - - share/htdocs/include/au/mail/taglines/taglines.xml ../trunk/au/mail/taglines/taglines.xml


replace each line in  the last (6th column) such that:


basically convert

aa/taglines.xml

to
../trunk/aa/mail/taglines/taglines.xml

basically

INTL/tagines.xml

to

../trunk/INTL/mail/taglines/taglines.xml

in the last column....

can i do it using command line perl/awk?

ASKER CERTIFIED SOLUTION
wilcoxon

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros