Re: Please tell me this is curable...
cjw44@cam.ac.uk (Colin Watson) wrote:
>r3ck@home.com (rick) wrote:
>>The problem is the lf -> crlf switch. Just reverse it. There
>>will be posts saying this won't work but it will. You'd think
>>it doesn't work because what about valid crlf pairs in the
>>original data. But they get changed to crcrlf by the ascii
>>transfer and back to crlf by the fix. It would be a problem
>>if you were hitting the data recursively but you're just doing
>>one pass.
>
>ASCII transfer isn't clever enough to spot CRLFs, then? (Can't test this
>just at the moment, so I'll take your word for it.)
>
>>I know there are little windows utils to do this but someone
>>can cobble up an awk one-liner or something. I did it with rexx.
>
>awk '{ print "\r" $0 }' seems to do it, though this is only lightly
>tested.
... as long as I read the problem the wrong way round. I of course
meant:
awk '{ gsub(/\r$/, ""); print }'
--
Colin Watson [cjw44@cam.ac.uk]
Reply to: