Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id C31C6782C38 for <~alpine/users@lists.alpinelinux.org>; Tue, 23 Feb 2021 10:03:40 +0000 (UTC) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 0F4D81A86B1; Tue, 23 Feb 2021 10:03:39 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alpine@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 3CE2E1A86B0; Tue, 23 Feb 2021 10:03:37 +0000 (UTC) Date: Tue, 23 Feb 2021 11:03:30 +0100 From: Natanael Copa To: Banibrata Dutta Cc: ~alpine/users@lists.alpinelinux.org Subject: Re: Windows/Dos ^M (CR/LF) removal on Alpine ash shell Message-ID: <20210223110330.3aa0b3dd@ncopa-desktop.lan> In-Reply-To: References: X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-alpine-linux-musl) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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