delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <f60fe000807300625r776876d5ra294a3c3072f9ec7@mail.gmail.com> |
Date: | Wed, 30 Jul 2008 09:25:25 -0400 |
From: | "Mark J. Reed" <markjreed AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Can't use special characters \n or \r |
In-Reply-To: | <009601c8f226$8f3344c0$9601a8c0@CAM.ARTIMI.COM> |
MIME-Version: | 1.0 |
References: | <18725646 DOT post AT talk DOT nabble DOT com> <009601c8f226$8f3344c0$9601a8c0 AT CAM DOT ARTIMI DOT COM> |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
> jay3205 wrote on 30 July 2008 04:46: > >> I have a text file made in Windows, and I'm trying to replace all the >> carriage returns with nothing. However, whenever I use \r or \n to >> indicate >> a carriage return or newline in a grep or sed search string, it is treated >> as a normal r and normal n. Anyone have any idea of what may be causing >> this? Yup. You're not quoting the backslash to keep bash from interpreting it. This command: sed -e s/\r// will get rid of all 'r's. This one: sed -e 's/\r//' will get rid of carriage returns. On Wed, Jul 30, 2008 at 5:28 AM, Dave Korn wrote: > Normal grep and sed don't speak C-style escape chars. Actually, sed does: $ od -c foo.txt 0000000 T h i s i s a t e s t . \r 0000020 \n 0000021 $ sed -e 's/\r//' foo.txt | od -c 0000000 T h i s i s a t e s t . \n 0000020 -- Mark J. Reed <markjreed AT gmail DOT com> -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |