Please use ***
[code][/code] tags*** around your code and data, to preserve formatting and to improve readability. Please do
not use quote tags, bolding, colors, or other fancy formatting.
I've seen this happen before. Your file is probably set with dos-style line endings. You need to convert your files to unix-style endings for most *nix tools to work properly.
sed can be used to convert the line endings at the same time. Just add a second expression to remove the extra carriage return.
Code:
sed -e 's/\r$//' -e 'y/\t/|/' infile >outfile
Notice how I used sed's '
y' command instead of '
s', which translates one set of characters into another.
But actually, most of the time when you want to do this,
tr is usually the preferred tool.
Code:
tr -d '\r' <infile | tr '\t' '|' >outfile