callmeGuy
callmeGuy

Reputation: 1054

Sed not replacing new line pattern in text file

I've got a txt file that I've retrieved from SQL Server Manager and hence the line delimitor is '\r\n'. I would like to change this line delimitor to '\n'. You can see my approach below. The problem is that even afer running the sed, it looks like '\r\n' was not replaced, as you can see below. What am I missing out here?

>>> grep \r\n some_file.txt |wc -l
21321

>>>sed -i 's/\r\n/\n/g' some_file.txt
>>> grep \r\n some_file.txt |wc -l
21321

I am using:

sed (GNU sed) 4.4

on Linux 4.15 Ubuntu

Upvotes: 0

Views: 888

Answers (1)

UtLox
UtLox

Reputation: 4164

try this:

sed -i 's/\r//' some_file.txt

Upvotes: 1

Related Questions