Date: Mon, 22 Dec 2008 05:31:08 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Gary Kline <kline@thought.org> Cc: freebsd-questions@freebsd.org Subject: Re: Sed question Message-ID: <87skogj37n.fsf@kobe.laptop> In-Reply-To: <20081221222744.GA28185@thought.org> (Gary Kline's message of "Sun, 21 Dec 2008 14:27:44 -0800") References: <20081221053407.GA87868@thought.org> <877i5unkx4.fsf@kobe.laptop> <1229854084.6392.52.camel@ethos> <20081221140658.GA24691@marge.bs.l> <20081221222744.GA28185@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 21 Dec 2008 14:27:44 -0800, Gary Kline <kline@thought.org> wrote: > perl -pi.bak -e 's/OLDSTRING/NEWSTRING/g' file1 file2 fileN > > that i swiped somewhere. [?] > > last night i was up until the wee hours coding or extending > a c++ program to assist in this stuff. while i really get > off on hacking code, it's less of a thrill at 02:10, say:_) You don't need C++ for this. If you don't mind the verbosity, Python can do the same thing with: #!/usr/bin/env python import sys skiplines = [1, 3] # line numbers that should be skipped lc = 0 for l in sys.stdin.readlines(): lc += 1 if not (lc in skiplines): print l,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87skogj37n.fsf>