On October 25, 2007 09:22:10 pm Tom Lane wrote:
>
> Did the sed actually do anything?  (Hint: the file size of
> geonames_fixed.txt would be larger than geonames.txt if it did.
> Or you could diff the two files to confirm that something sensible
> happened.)
>
> I suspect that your shell may be fouling things up here.  You may need
> to prepare this command as a one-line shell script, using an editor that
> doesn't barf on bare carriage returns ...

Can I ask this, what is the objective here?

I have a field with ^M$ in it (shows as CR/LF in text editor).  The objective 
should be to replace the CR/LF with just a CR shouldn't it?

Or is the objective to replace the CR/LF with a literal \r?  I'm a bit 
confused by the output of COPY that says to use "\r".  Looking at other data 
in my database (user message) I'd have to say it needs to be replaced with a 
literal \r correct?

If that is the case, the sed script doesn't work because it is only replacing 
the CR and still leaves the LF which terminates a line.  I found a little 
perl to do the job of replacing the CR/LF with a literal \r

perl -p -e 's/\r\n/\\r/g' < cities.txt > cities_fixed.txt


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to