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
Hello,
The dos2unix command, which is available in package dos2unix, would
probably do what you want.
Le mar. 23 févr. 2021 à 06:00, Banibrata Dutta <banibrata.dutta@gmail.com>
a écrit :
> 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.>
--
Sébastien
https://www.maccagnoni.eu/
On Tue, 23 Feb 2021 10:29:50 +0530
Banibrata Dutta <banibrata.dutta@gmail.com> wrote:
> 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
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
Thanks a lot, Natanel and Sebastien.
On Tue, Feb 23, 2021 at 3:33 PM Natanael Copa <ncopa@alpinelinux.org> wrote:
> On Tue, 23 Feb 2021 10:29:50 +0530> Banibrata Dutta <banibrata.dutta@gmail.com> wrote:>> > 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>> 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>
--
regards,
Banibrata
http://www.linkedin.com/in/bduttahttp://twitter.com/edgeliving