I have a text file which contains lines in this format - it contains 105 lines in total, but I'm just putting 4 here to keep it short:
58571,east_ppl_ppla_por
58788,east_pcy_hd_por
58704,east_pcy_ga_por
58697,east_pcy_pcybs_por
It's called id_key.txt
I have a sample folder called start_folder
The folder contains 2 xml files:
SearchBoxRN.xml
ShoppingHomePG.xml
Each xml file contains, amongst other things, the following text:
user:responsibilityKey="east_ppl_ppl_por"
I'd really like to be able to loop through the id_key.txt file, and for each line - e.g. the first line in id_key.txt:
Copy the start_folder and its contents
- Rename the folder from "start_folder" to the first bit of the current line from the id_key.txt file - e.g. 58571
- Update SearchBoxRN.xml and change user:responsibilityKey="east_ppl_ppl_por" to user:responsibilityKey="east_ppl_ppla_por"
- Update ShoppingHomePG.xml and change user:responsibilityKey="east_ppl_ppl_por" to user:responsibilityKey="east_ppl_ppla_por"
This seems like a long shot to me, but I'm no expert.
I've tried looking at using a windows batch file on a PC, but we also have a unix environment at work, and if it's possible to do this task in UNIX, then that'd be great, because the alternative involves manually editing 525 XML files by hand, and creating 315 folders...
I'm afraid I am a real novice with unix. I can do simple stuff like copy files, delete files, but have never done anything with vi or other unix text editors.
Any advice much appreciated.
Thanks!