Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 70398782B8E for <~alpine/users@lists.alpinelinux.org>; Tue, 23 Feb 2021 19:30:01 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id d24so12968527lfs.8 for <~alpine/users@lists.alpinelinux.org>; Tue, 23 Feb 2021 11:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HzW6UfPh025T+aUCjZv3WswBQhvZU8BOcMj7GE+FD9k=; b=oNElTep2rrfiRVrzxFbhHKXRyRqBgh8CmHguFLntji21ATyA5eECxVQdez3APMiRs5 ZAYCSttqBaXsPwNjCi7nWwyLEnKlq1PTtY0Vl26ivrgM/bLnsi4r6sgBCnzQ8SCLLDGU nJwHDMEFutwOvV6f2urYLUOvwqWDbG0/gEQ4VWpDEk5JNNNq6AhRA+HLubVeOXydXU8f XvCr9dwfSUEvutejdyY2Kd9LdahVbz23I0gIxh5RPJgNG0ubU7JYxpwT0t/rI34C+1eA GNkgwkoIavfWCSS7ehZPXd/3uUI+j9Qpm50AVZ9nGHKJvhD4V5cASLAKQ0Qr2y8jJMDK 30LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HzW6UfPh025T+aUCjZv3WswBQhvZU8BOcMj7GE+FD9k=; b=EcYvBipqSnV3ISVYQ1Ziw1OXB63gI7I6ywVKyFFlknlah2xpgBNOj8tpNDZUuoYILu 4XAxKkmJSCHAW6Fw2XiudvyyptFB+YNId9pccQubWhYo5Ca9eLmzPIANnt9HlgIJqR7B P1P+SeGVZLmwfGM5gLRgFucB087EJv7uS9kt4fGq7PEoBXbMox7QcpA3seyXZ3hUxI0Y 7FlmBCtmhmW/6wF6H7OgxDdaNYkwAQY88H1U4U+Uw+lXVU6V8m5bJiC0nvZW28xYDitg XEvnpG7w0wkKb92RlBms3hFWGdLjvg921Vlf38tWZbFbgMsEK0SWrBW7U+Cqq2w1sGc/ 7VKQ== X-Gm-Message-State: AOAM5312hD2bOwlcpmU8PPMLq+bYxTogAoFKdFKlVfLERcWpFKj0pvw2 cX3yZglZ/pfZfIzPKYRLSfqUgTDtO22YsUEf5W4= X-Google-Smtp-Source: ABdhPJycQtZSDFxjIb4BJUjN8jKLJynvHw3HDVN9+XX7JutJOGtGDXO/KUfuy8R3Gv+WqZsS8Xo2FgjJRpY4JWlv7G8= X-Received: by 2002:a19:7fce:: with SMTP id a197mr18265484lfd.77.1614108599995; Tue, 23 Feb 2021 11:29:59 -0800 (PST) MIME-Version: 1.0 References: <20210223110330.3aa0b3dd@ncopa-desktop.lan> In-Reply-To: <20210223110330.3aa0b3dd@ncopa-desktop.lan> From: Banibrata Dutta Date: Wed, 24 Feb 2021 00:59:47 +0530 Message-ID: Subject: Re: Windows/Dos ^M (CR/LF) removal on Alpine ash shell To: Natanael Copa Cc: ~alpine/users@lists.alpinelinux.org Content-Type: multipart/alternative; boundary="000000000000bb4efb05bc05f1ba" --000000000000bb4efb05bc05f1ba Content-Type: text/plain; charset="UTF-8" Thanks a lot, Natanel and Sebastien. On Tue, Feb 23, 2021 at 3:33 PM Natanael Copa wrote: > On Tue, 23 Feb 2021 10:29:50 +0530 > Banibrata Dutta 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/bdutta http://twitter.com/edgeliving --000000000000bb4efb05bc05f1ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks a lot, Natanel and Sebastien.

On Tue, Feb 23, 20= 21 at 3:33 PM Natanael Copa <nc= opa@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 Alpin= e ?
> In bash, I could use sed and the Control-V+Control-M character to inje= ct ^M
> in the regex pattern to find/replace. That combination doesn't see= m to work
> on Alpine ash.
>
> thanks
> BD

you can do:

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

or:

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

or use the mentioned dos2unix tool


-nc


--
--000000000000bb4efb05bc05f1ba--