Thanks for all your help!!But i came to know that data in the file can come as 12345|1|1111|131|678|134121
|1|A|BCDEF
Now i want to replace "1" which is
highlighted above with "2" then how it can be done??The final output must look like:
12345|1|1111|131|678|134121
|2|A|BCDEF
One more thing though "1" can come at any index, this is sure that at 7th index "1" will definetly come and i want to replace this "1" which is present at 7th index with "2"..I tried the following:
sed 's/`cut -d"|" -f7`/"2"/g' but the problem is cut command will extract "1" from 7th index and then sed command is replacing all 1's in a file with 2's
Please help
