From owner-freebsd-questions@FreeBSD.ORG Fri May 12 16:09:53 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 0745716A4C8 for ; Fri, 12 May 2006 16:09:53 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 594E543D80 for ; Fri, 12 May 2006 16:09:50 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id F1E455D4B; Fri, 12 May 2006 12:09:48 -0400 (EDT) X-Virus-Scanned: amavisd-new at codefab.com Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SDe31XL9jGSe; Fri, 12 May 2006 12:09:48 -0400 (EDT) Received: from [192.168.1.251] (pool-68-160-235-217.ny325.east.verizon.net [68.160.235.217]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pi.codefab.com (Postfix) with ESMTP id 124CD5C5D; Fri, 12 May 2006 12:09:48 -0400 (EDT) Message-ID: <4464B349.9030306@mac.com> Date: Fri, 12 May 2006 12:09:45 -0400 From: Chuck Swiger User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Giorgos Keramidas References: <200605121450.k4CEokhn022089@dc.cis.okstate.edu> <20060512150608.GB25497@gothmog.pc> <4464A94C.6020606@mac.com> <20060512153141.GA26040@gothmog.pc> In-Reply-To: <20060512153141.GA26040@gothmog.pc> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Martin McCormick , freebsd-questions@freebsd.org Subject: Re: Trimming Whitespace From Beginning and end of Text Lines X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 May 2006 16:09:59 -0000 Giorgos Keramidas wrote: > On 2006-05-12 11:27, Chuck Swiger wrote: > >> It is, and I wish to acknowledge the above are entirely valid solutions >> to the problem, but... >> >> python -c 'import sys; print sys.stdin.read().strip()' < file... >> >> ...has the advantage of being human readable. My old 300-baud accoustic >> modem used to generate output which in hindsight looks astonishingly >> close to regex character classes. :-) >> > > HEH! I see the joke about Perl being similar to "line noise" is not > something local to our Greek IRC channels :) Indeed. :) I must confess that it doesn't do in-place replacement of the files, though. I'd have to do a two-liner, I guess: python -c 'import sys,fileinput for line in fileinput.input(inplace=1): print line.strip()' file1 file2 ... -- -Chuck