Date: Fri, 12 May 2006 12:09:45 -0400 From: Chuck Swiger <cswiger@mac.com> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: Martin McCormick <martin@dc.cis.okstate.edu>, freebsd-questions@freebsd.org Subject: Re: Trimming Whitespace From Beginning and end of Text Lines Message-ID: <4464B349.9030306@mac.com> In-Reply-To: <20060512153141.GA26040@gothmog.pc> References: <200605121450.k4CEokhn022089@dc.cis.okstate.edu> <20060512150608.GB25497@gothmog.pc> <4464A94C.6020606@mac.com> <20060512153141.GA26040@gothmog.pc>
next in thread | previous in thread | raw e-mail | index | archive | help
Giorgos Keramidas wrote: > On 2006-05-12 11:27, Chuck Swiger <cswiger@mac.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4464B349.9030306>