Hey guys,
I am running a cronjob that downloads a datafeed text file and I need to trim the first 3 characters from the 3rd column data (excluding the header).
This is what I have so far:
awk 'NR==1{print;next}{$3=substr($3,4)}1' OFS="\t" file > newfile
Column Zero is Product Name, which has multiple words and Spaces. Column One is a long text description, and column two is the SKU, which I need to trim (i.e. xxxABCDEFG > ABCDEFG).
ISSUE:
The above code breaks my datafile and makes new columns for every SPACE. It seems like the \t is not working correctly. Instead, it's stripping all of the tab delimitation and spacing every word.
Any help with this would be greatly appreciated. Thanks in advance!!!
- Rick
I am running a cronjob that downloads a datafeed text file and I need to trim the first 3 characters from the 3rd column data (excluding the header).
This is what I have so far:
awk 'NR==1{print;next}{$3=substr($3,4)}1' OFS="\t" file > newfile
Column Zero is Product Name, which has multiple words and Spaces. Column One is a long text description, and column two is the SKU, which I need to trim (i.e. xxxABCDEFG > ABCDEFG).
ISSUE:
The above code breaks my datafile and makes new columns for every SPACE. It seems like the \t is not working correctly. Instead, it's stripping all of the tab delimitation and spacing every word.
Any help with this would be greatly appreciated. Thanks in advance!!!
- Rick