here is even a smaller version of
perl -i -pe 's/\r\n/\n/' filename
which says...
-i do the modification in place
-p read and process every line/record of the file
-e run the following expressiion
's/\r\n/\n/' substitude '\r\n' with '\n'
Then create an alias like
alias dos2unix="perl -i -pe 's/\r\n/\n/' "
And then say
dos2unix myfile
And here is unix2dos
alias unix2dos="perl -i -pe 's/\n/\r\n/' "
Yes I know Solaris has dos2unix(1) and unix2dos(1), I'm just having a
little fun...
By the way these work on both Unix and NT environment, find a substitude
for aliases
on NT.
John wrote:
>Thanks Tom.. I had a buddy who works with perl give me a little help
>since I couldn't get vim to see the \r.. the following one liner got me
>where I needed to be. Thanks again.
>
>cat origfile|perl -e 'while (<>){$_ =~ s/\r//g;print $_;}' > prepfile
>
>-----Original Message-----
>I think you've got DOS-style newlines (\r\n) in your data file.
>Get rid of the carriage return characters (\r) and you'll be set.
>
> regards, tom lane
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>