Nandika Kodituwakku
asked on
Unix Shell Scripting to Change the header of the file in Unix
Hi,
I have a situation here:
I have some files:
update_1.dat, update_2.dat,update_3.dat. ....update _x.dat
Each file will have a header as first record in it to determine it's sequence.
Say for ex:
update_1.dat
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|1|1|
update_2.dat
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|1|1|
The above is what I have right now..
I am expecting and what I am trying to achieve is
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|1|2| -- Update_1.dat
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|2|2| -- Update_2.dat and so on
If I have three files ,then header should be
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|1|3| -- Update_1.dat
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|2|3| -- Update_2.dat and so on
001|201501300940193201|XXX X02|1|2015 01303|YYYY 30|20|3|3| -- Update_2.dat and so on
I want some advices and suggestions to achieve this.
Also, it would be great if I get the sample code piece to achieve the above scenario.
Thanks
I have a situation here:
I have some files:
update_1.dat, update_2.dat,update_3.dat.
Each file will have a header as first record in it to determine it's sequence.
Say for ex:
update_1.dat
001|201501300940193201|XXX
update_2.dat
001|201501300940193201|XXX
The above is what I have right now..
I am expecting and what I am trying to achieve is
001|201501300940193201|XXX
001|201501300940193201|XXX
If I have three files ,then header should be
001|201501300940193201|XXX
001|201501300940193201|XXX
001|201501300940193201|XXX
I want some advices and suggestions to achieve this.
Also, it would be great if I get the sample code piece to achieve the above scenario.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the solution is posted, you should accept the solution. You cannot delete it, just because.
ASKER
I want to hide it..I got the solution from the expert..I am happy