Subject: Windows/Dos ^M (CR/LF) removal on Alpine ash shell

From: Banibrata Dutta <[email-masked]>
Date: Tue, 23 Feb 2021 10:29:50 +0530

Hi,

What would be the recommended way to remove the Control-M (CR/LF
combination from DOS/Windows produced text file) in ash shell on Alpine ?
In bash, I could use sed and the Control-V+Control-M character to inject ^M
in the regex pattern to find/replace. That combination doesn't seem to work
on Alpine ash.

thanks
BD

---

From: Sébastien Maccagnoni <[email-masked]>
Date: Tue, 23 Feb 2021 09:11:22 +0100

Hello,

The dos2unix command, which is available in package dos2unix, would
probably do what you want.

-- 
Sébastien
https://www.maccagnoni.eu/

---

From: Natanael Copa <[email-masked]>
Date: Tue, 23 Feb 2021 11:03:30 +0100

On Tue, 23 Feb 2021 10:29:50 +0530

> in the regex pattern to find/replace. That combination doesn't seem to work

you can do:

  tr -d '\015' < dos.txt > unix.txt

or:

  sed $'s/\r$//' < dos.txt > unix.txt

or use the mentioned dos2unix tool

-nc

---

From: Banibrata Dutta <[email-masked]>
Date: Wed, 24 Feb 2021 00:59:47 +0530

Thanks a lot, Natanel and Sebastien.

-- 
regards,
Banibrata
http://www.linkedin.com/in/bdutta
http://twitter.com/edgeliving