Re-delimit a large file

So what if you have an huge file that you cant simply open and do a find and replace on? But you need to change the delimiters so as to process it somewhere else.

We can use sed to accomplish this in UNIX.

sed -e ‘s+,+\*+g’ bigfile.prn > bigfile_newdelim.csv

Then simply repace the current delimiter “~” with a new one, say “,”

sed -e ‘s+~+,+g’ bigfile_newdelim.csv > bigfile.csv

Delete the *newdelim file afterwards I reckon.

Leave a Reply