From owner-freebsd-questions Wed Apr 3 17:44:48 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mailg.telia.com (mailg.telia.com [194.22.194.26]) by hub.freebsd.org (Postfix) with ESMTP id 70E3F37B41A for ; Wed, 3 Apr 2002 17:44:38 -0800 (PST) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailg.telia.com (8.11.6/8.11.6) with ESMTP id g341ib029984 for ; Thu, 4 Apr 2002 03:44:37 +0200 (CEST) Received: from falcon.midgard.homeip.net (h68n2fls20o913.telia.com [212.181.163.68]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id DAA08947 for ; Thu, 4 Apr 2002 03:44:36 +0200 (CEST) Received: (qmail 71827 invoked by uid 1001); 4 Apr 2002 01:44:34 -0000 Date: Thu, 4 Apr 2002 03:44:34 +0200 From: Erik Trulsson To: Peter Leftwich Cc: Warren Block , ann kok , FreeBSD Questions Subject: Re: special charaters (return key) Message-ID: <20020404014434.GA71781@student.uu.se> Mail-Followup-To: Peter Leftwich , Warren Block , ann kok , FreeBSD Questions References: <20020403203320.X70185-100000@earl-grey.cloud9.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020403203320.X70185-100000@earl-grey.cloud9.net> User-Agent: Mutt/1.3.28i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Apr 03, 2002 at 08:34:57PM -0500, Peter Leftwich wrote: > On Wed, 3 Apr 2002, Warren Block wrote: > > On Wed, 3 Apr 2002, ann kok wrote: > > > how do type the special charater? ^M (return key) I want to remove it on the file > > > sed 's/^M//g' crt1.txt > > Seems like last time I wanted to do this, the BSD sed didn't understand that a \r should be a return. Perl does, though: > > perl -pi -e 's/\r//g' crt1.txt > > -Warren Block * Rapid City, South Dakota USA > > This was going to be part of my suggested rememdy (i.e. to use perl) but it > seemed too complex. The manpage for "perl" doesn't mention -pi nor does it > mention -e; Could you explain what this command does? I think there should > be a simple command to change a file into one long line :) 'man perl' does not document the switches. 'man perlrun' does. Briefly: -e Next argument is the perl program to run. -p Iterate over all the lines in all the files given as arguments. Print the result of each step to stdout. -i Do the editing inline instead of sending it to stdout. (One can optionally create a backup file.) So what the program above does is: For each line in each file specified (crt1.txt above), replace each \r with an empty string, (i.e. remove it.) To change a file into one long lime you can use the above program. Just change \r into \n. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message