From owner-freebsd-questions@FreeBSD.ORG Tue Apr 15 06:54:17 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 ADEE337B401 for ; Tue, 15 Apr 2003 06:54:17 -0700 (PDT) Received: from spxgate.servplex.com (ip66-105-58-82.z58-105-66.customer.algx.net [66.105.58.82]) by mx1.FreeBSD.org (Postfix) with ESMTP id C9C8E43F75 for ; Tue, 15 Apr 2003 06:54:16 -0700 (PDT) (envelope-from peter@servplex.com) Received: from peter.servplex.com ([192.168.0.10]) by spxgate.servplex.com (8.12.8/8.12.6) with ESMTP id h3FE5Zxj096623; Tue, 15 Apr 2003 09:05:36 -0500 (CDT) (envelope-from peter@servplex.com) Message-Id: <5.2.0.9.2.20030415085340.01bae4a0@mail.servplex.com> X-Sender: peter@mail.servplex.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Tue, 15 Apr 2003 08:56:15 -0500 To: CARTER Anthony From: Peter Elsner In-Reply-To: <200304151041.57911.a.carter@intrasoft.lu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed cc: freebsd-questions@FreeBSD.ORG Subject: Re: dos2unix??? 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: Tue, 15 Apr 2003 13:54:18 -0000 Here's a small Perl script... Name it dtox and placed it in your /usr/local/bin directory... #!/usr/bin/perl # SCRIPT: dtox # AUTHOR: Peter Elsner # PURPOSE: Convert Text files from DOS to UNIX (remove ^M's) # while (<>) { if ($ARGV ne $OLDARGV) { rename($ARGV, $ARGV . '.bak'); open(ARGVOUT, ">$ARGV"); select(ARGVOUT); $OLDARGV=$ARGV; } s/^M//g; } continue { print; } select(STDOUT); exit; Use it as follows: % dtox filename A back up file is created filename.bak and then a new file is created with the ^M's removed... Peter At 10:41 AM 4/15/2003 +0200, you wrote: >Is there an equivalent dos2unix program that will strip out DOS character >codes from text files? > >Thanks, >Anthony >_______________________________________________ >freebsd-questions@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-questions >To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" ---------------------------------------------------------------------------------------------------------- Peter Elsner Vice President Of Customer Service (And System Administrator) 1835 S. Carrier Parkway Grand Prairie, Texas 75051 (972) 263-2080 - Voice (972) 263-2082 - Fax (972) 489-4838 - Cell Phone (425) 988-8061 - eFax I worry about my child and the Internet all the time, even though she's too young to have logged on yet. Here's what I worry about. I worry that 10 or 15 years from now, she will come to me and say "Daddy, where were you when they took freedom of the press away from the Internet?" -- Mike Godwin Unix IS user friendly... It's just selective about who its friends are. System Administration - It's a dirty job, but somebody said I had to do it. If you receive something that says 'Send this to everyone you know, pretend you don't know me. Standard $500/message proofreading fee applies for UCE.