Hello Everyone,
I have many files like so:
file1.txt
file2.txt
file3.txt
Within each file I have many lines of random text separated by commas like so:
abcAAA,123,defAA,456777,ghiA,789
jklB,101,mnoBBB,11211,pqrB,13111
stuCC,415,vwxCCCC,161,yzaC,718
I am trying to use SED or AWK to replace the 4th column with XXX on each line in each file so the result would be:
The same files like so:
file1.txt
file2.txt
file3.txt
Now within each file:
abcAAA,123,defAA,XXX,ghiA,789
jklB,101,mnoBBB,XXX,pqrB,13111
stuCC,415,vwxCCCC,XXX,yzaC,718
I have a workaround that I've come up with but it combines all the files into one file, unfortunately. (I need the files to be edited in place)
Here is my attempt:
cat *.txt | awk -F, '{print $1 "," $2 "," $3 ",XXX," $5 "," $6}' > result_file.txt