I had to add a column on a text file (edit with Notepad++ on Windows), adding an incremental counter.
I’ve wrote my bash-awk script on Ubuntu and used it on the text file imported from Windows. It works fine, but the new column is on a newline and not near other columns.
Even if I pipe sed 's/\r\n//g' the column is on a newline.
Could this be a problem over the different handle on the newline between Unix and Windows or something is wrong with my sed instruction?
Thanks
If your file looks something like this:
Use this to append alternating lines and remove the carriage return:
The result will look like: