Anthony Mellor
asked on
AWK How to eradicate Windows carriage returns from 52 files now on unix/mac?
7 CSV FILES
9 tab files
36 dat files
and of course I'm not sure what the delimiter is in the dats and tab files.
I guess I have to hex view and see.
So an awk question with multiple delimiters: or, process each group separately.
The hex codes of the Windows line eols or carriage returns are 0d0a .
Doing one file isn't the issue, it's doing all 54.
I will hex view now and see if i can spot the delimiters in the tabs and dats.
I found this code but it's Greek to me.
9 tab files
36 dat files
and of course I'm not sure what the delimiter is in the dats and tab files.
I guess I have to hex view and see.
So an awk question with multiple delimiters: or, process each group separately.
The hex codes of the Windows line eols or carriage returns are 0d0a .
Doing one file isn't the issue, it's doing all 54.
I will hex view now and see if i can spot the delimiters in the tabs and dats.
I found this code but it's Greek to me.
awk 'gsub(/\r/,""){printf $0;next}{print}'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
installed dos2unix, successful command to convert all files in directory/folder
dos2unix *.*
proof of the pudding:
MacPro:Original Data ADM$ dos2unix *.*
dos2unix: converting file DfTRoadSafety_Accidents_20 05.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 06.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 07.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 08.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 09.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 10.csv to Unix format...
dos2unix: converting file DfTRoadSafety_Accidents_20 11.csv to Unix format...
dos2unix: converting file acc00.tab to Unix format...
dos2unix: converting file acc01.tab to Unix format...
dos2unix: converting file acc02.tab to Unix format...
dos2unix: converting file acc03.tab to Unix format...
dos2unix: converting file acc04.tab to Unix format...
dos2unix: converting file acc87.tab to Unix format...
dos2unix: converting file acc88.tab to Unix format...
dos2unix: converting file acc89.tab to Unix format...
dos2unix: converting file acc90.tab to Unix format...
dos2unix: converting file acc91_a.dat to Unix format...
dos2unix: converting file acc91_b.dat to Unix format...
dos2unix: converting file acc91_c.dat to Unix format...
dos2unix: converting file acc91_d.dat to Unix format...
dos2unix: converting file acc92_a.dat to Unix format...
dos2unix: converting file acc92_b.dat to Unix format...
dos2unix: converting file acc92_c.dat to Unix format...
dos2unix: converting file acc92_d.dat to Unix format...
dos2unix: converting file acc93_a.dat to Unix format...
dos2unix: converting file acc93_b.dat to Unix format...
dos2unix: converting file acc93_c.dat to Unix format...
dos2unix: converting file acc93_d.dat to Unix format...
dos2unix: converting file acc94_a.dat to Unix format...
dos2unix: converting file acc94_b.dat to Unix format...
dos2unix: converting file acc94_c.dat to Unix format...
dos2unix: converting file acc94_d.dat to Unix format...
dos2unix: converting file acc95_a.dat to Unix format...
dos2unix: converting file acc95_b.dat to Unix format...
dos2unix: converting file acc95_c.dat to Unix format...
dos2unix: converting file acc95_d.dat to Unix format...
dos2unix: converting file acc96_a.dat to Unix format...
dos2unix: converting file acc96_b.dat to Unix format...
dos2unix: converting file acc96_c.dat to Unix format...
dos2unix: converting file acc96_d.dat to Unix format...
dos2unix: converting file acc97_a.dat to Unix format...
dos2unix: converting file acc97_b.dat to Unix format...
dos2unix: converting file acc97_c.dat to Unix format...
dos2unix: converting file acc97_d.dat to Unix format...
dos2unix: converting file acc98_a.dat to Unix format...
dos2unix: converting file acc98_b.dat to Unix format...
dos2unix: converting file acc98_c.dat to Unix format...
dos2unix: converting file acc98_d.dat to Unix format...
dos2unix: converting file acc99_a.dat to Unix format...
dos2unix: converting file acc99_b.dat to Unix format...
dos2unix: converting file acc99_c.dat to Unix format...
dos2unix: converting file acc99_d.dat to Unix format...
MacPro:Original Data ADM$
took the time it took to write this post. About 600 mb of text files.
[embed=file 1148430]
acc03_txt_and_-acc02_txt.jpg
dos2unix *.*
proof of the pudding:
MacPro:Original Data ADM$ dos2unix *.*
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file DfTRoadSafety_Accidents_20
dos2unix: converting file acc00.tab to Unix format...
dos2unix: converting file acc01.tab to Unix format...
dos2unix: converting file acc02.tab to Unix format...
dos2unix: converting file acc03.tab to Unix format...
dos2unix: converting file acc04.tab to Unix format...
dos2unix: converting file acc87.tab to Unix format...
dos2unix: converting file acc88.tab to Unix format...
dos2unix: converting file acc89.tab to Unix format...
dos2unix: converting file acc90.tab to Unix format...
dos2unix: converting file acc91_a.dat to Unix format...
dos2unix: converting file acc91_b.dat to Unix format...
dos2unix: converting file acc91_c.dat to Unix format...
dos2unix: converting file acc91_d.dat to Unix format...
dos2unix: converting file acc92_a.dat to Unix format...
dos2unix: converting file acc92_b.dat to Unix format...
dos2unix: converting file acc92_c.dat to Unix format...
dos2unix: converting file acc92_d.dat to Unix format...
dos2unix: converting file acc93_a.dat to Unix format...
dos2unix: converting file acc93_b.dat to Unix format...
dos2unix: converting file acc93_c.dat to Unix format...
dos2unix: converting file acc93_d.dat to Unix format...
dos2unix: converting file acc94_a.dat to Unix format...
dos2unix: converting file acc94_b.dat to Unix format...
dos2unix: converting file acc94_c.dat to Unix format...
dos2unix: converting file acc94_d.dat to Unix format...
dos2unix: converting file acc95_a.dat to Unix format...
dos2unix: converting file acc95_b.dat to Unix format...
dos2unix: converting file acc95_c.dat to Unix format...
dos2unix: converting file acc95_d.dat to Unix format...
dos2unix: converting file acc96_a.dat to Unix format...
dos2unix: converting file acc96_b.dat to Unix format...
dos2unix: converting file acc96_c.dat to Unix format...
dos2unix: converting file acc96_d.dat to Unix format...
dos2unix: converting file acc97_a.dat to Unix format...
dos2unix: converting file acc97_b.dat to Unix format...
dos2unix: converting file acc97_c.dat to Unix format...
dos2unix: converting file acc97_d.dat to Unix format...
dos2unix: converting file acc98_a.dat to Unix format...
dos2unix: converting file acc98_b.dat to Unix format...
dos2unix: converting file acc98_c.dat to Unix format...
dos2unix: converting file acc98_d.dat to Unix format...
dos2unix: converting file acc99_a.dat to Unix format...
dos2unix: converting file acc99_b.dat to Unix format...
dos2unix: converting file acc99_c.dat to Unix format...
dos2unix: converting file acc99_d.dat to Unix format...
MacPro:Original Data ADM$
took the time it took to write this post. About 600 mb of text files.
[embed=file 1148430]
acc03_txt_and_-acc02_txt.jpg
ASKER
Bill, by email and dropbox variously.
Easy enough to massage the data with a small VBS script, I have some samples that do things like this I can provide, but I would suggest you post a few different sample files here (if possible) so that I can view and look for what needs to be changed.
~bp