[PLUG] Translating ^M to \n

Galen Seitz galens at seitzassoc.com
Tue Aug 13 00:14:53 UTC 2019


On 8/12/19 4:34 PM, Rich Shepard wrote:
> On Mon, 12 Aug 2019, Michael Ewan wrote:
> 
>> tr is your friend
>> tr '\013' '\n' < old_file > new_file
>> this will probably work also
>> tr '\r' '\n' < old_file > new_file
> 
> Michael,
> 
> As I've written, it should but doesn't.
> 
> The smallest file can be downloaded from <https://tinyurl.com/y54p8xgv>.

Looks like a mixture of line endings.  I'm seeing both CR and LF in that 
file.

[galens at toto ~]$ wc -l Downloads/hatchery_returns-2019-08-12.csv
102 Downloads/hatchery_returns-2019-08-12.csv

Converting CR to LF and then counting lines yields 10801.

There's also one instance of a CRLF at the end of the file.

Perhaps there are some LF characters embedded in strings.  I didn't 
bother to dive in any farther.


galen
-- 
Galen Seitz
galens at seitzassoc.com



More information about the PLUG mailing list