Sunday, January 1, 2017

linux: can't grep/join txt file due to weird parsing

It's probably due to special windows characters hidden in your txt file created on Windows

One way to tell is:

wc $(head -1 yourtxtfile)

to see from the error message whether your first line contains anything like '$'\r'

If yes, you can remove them on Linux by using:
awk '{ sub("\r$", "");print $1}'  yourtxtfile

No comments:

Post a Comment