Unix Script for replacing text in files
Dear Experts,
I am new to unix shell programming. I need to write a script which needs to edit 4 text files.
File 1:- PCH_Test.txt
File 2:- PCT_Test.txt
File 3:- PCY_Test.txt
File 4:- PCW_Test.txt
PCH_Test.txt
First it needs to get into PCH_Test file and prefix the 6th coloumn with PCH i.e, replace 6th column with PCHXXX for all the records in the file.
Content:-
2009001,2009,XP0000AB20,XPA,GT01,CSP,127.500
2009001,2009,XP0000AB20,XPD,GT04,CSK,192.500
2009001,2009,XP0000AB20,XPE,GT13,CSK,472.500
2009001,2009,XP0000AB20,XPF,GT16,CSJ,787.500
2009001,2009,XP0000AB20,XPH,GT19,CSH,172.500
My Desired Output:-
2009001,2009,XP0000AB20,XPA,GT01, PCHCSP,127.500
2009001,2009,XP0000AB20,XPD,GT04, PCHCSK,192.500
2009001,2009,XP0000AB20,XPE,GT13, PCHCSK,472.500
2009001,2009,XP0000AB20,XPF,GT16, PCHCSJ,787.500
2009001,2009,XP0000AB20,XPH,GT19, PCHSH,172.500
Like this it needs to get into PCT, PCY and PCW files and prefix the 6th column with corresponding names...like PCTXXX in PCT file, PCYXXX in PCY file and PCWXXX in PCW file....