From owner-freebsd-questions@FreeBSD.ORG Sat Nov 22 06:49:31 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E5A216A4CE for ; Sat, 22 Nov 2003 06:49:31 -0800 (PST) Received: from clunix.cl.msu.edu (clunix.cl.msu.edu [35.9.2.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id B74BC43FDF for ; Sat, 22 Nov 2003 06:49:29 -0800 (PST) (envelope-from jerrymc@clunix.cl.msu.edu) Received: (from jerrymc@localhost) by clunix.cl.msu.edu (8.11.7p1+Sun/8.11.7) id hAMEnNT24343; Sat, 22 Nov 2003 09:49:23 -0500 (EST) From: Jerry McAllister Message-Id: <200311221449.hAMEnNT24343@clunix.cl.msu.edu> To: weiwuzhang@hotmail.com (Zhang Weiwu) Date: Sat, 22 Nov 2003 09:49:23 -0500 (EST) In-Reply-To: <3FBF5DEA.2030405@hotmail.com> from "Zhang Weiwu" at Nov 22, 2003 09:00:26 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: newbie: use in RE? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Nov 2003 14:49:31 -0000 > > Hello. Just want to know how to use special character in Regular Expression. > > I wish to remove all the carrier returns from a text file, I can use: > tr -d "\r" < text_file > modified_text_file > But if I do: > sed -i s/\r//g text_file > it actually removes all the character "r" from the file. > > This is also a problem in vi(1). Besides I wish to manipulate > tabstops and line-feeds with RE too. So why not just use tr? \t should get tabs, as you noted \r gets CRs I don't know linefeed off hand, but wouldn't be surprised if it was \l. It follows the usual conventions. There are more things besides -d that you can do with tr also. ////jerry >