I have a file which has pipe delimited data and i want to remove this string "EES" after 17th occurrence of pipe and write the data back to same file again
Below is the input i want to pass
AMC|FRS|M|123456|01/30/1992|QWERT||WERTYU|OK|USA|74000|1234567|QQ|34567142|11/01/2011|12/31/9999|Y|V3EES|13
below is the output i'm expecting
AMC|FRS|M|123456|01/30/1992|QWERT||WERTYU|OK|USA|74000|1234567|QQ|34567142|11/01/2011|12/31/9999|Y|V3|13
Help is appreciated, Thanks in advance!!!
Using
awk
Using
grep
&awk
Following awk should help you in same.
Explanation: Making here field separator as
|
(pipe) as per OP's Input_file then using awk's substitute utility sub where I am mentioning that replace string EES with NULL in column 18. Now mentioning 1 which will print the lines(edited/non-edited 18th column). Setting OFS(Output field separator as |(pipe)) here to get | in output, then mentioning the Input_file.