Assume dir structure as dir1/dir2/table_pid_id1.xml etc..
Command to find these files and replace the strings inside xml file using perl :
a)first find the files and rename them from table_pid_id1.xml to table_newpid_id1.xml etc..
for fn in `find dir1/ -maxdepth 2 -name "*pid*" ` ; do echo $fn ; mv $fn $(echo $fn | sed 's/pid/newpid/') ;done
b)then, find the new files and replace the pid inside the files with newpid .
find dir1/ -maxdepth 2 -name "*pid_*.xml" | xargs -i perl -i.bak -wple '$_ =~ s/'pid'/'newpid'/g;' {} ;
No comments:
Post a Comment