MESSAGE
| DATE | 2011-12-15 |
| FROM | Ruben Safir
|
| SUBJECT | Re: [NYLXS - HANGOUT] A simple perl script
|
From owner-hangout-outgoing-at-mrbrklyn.com Thu Dec 15 06:25:50 2011 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix) id 3202D100B72; Thu, 15 Dec 2011 06:25:50 -0500 (EST) Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix, from userid 28) id 20C1D100B80; Thu, 15 Dec 2011 06:25:50 -0500 (EST) Delivered-To: hangout-at-mrbrklyn.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by www2.mrbrklyn.com (Postfix) with ESMTP id CDCF7100B72 for ; Thu, 15 Dec 2011 06:25:49 -0500 (EST) Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 7A66A28E55 for ; Thu, 15 Dec 2011 06:27:33 -0500 (EST) Received: by panix2.panix.com (Postfix, from userid 20529) id 69A3D33C94; Thu, 15 Dec 2011 06:27:33 -0500 (EST) Date: Thu, 15 Dec 2011 06:27:33 -0500 From: Ruben Safir To: hangout-at-mrbrklyn.com Subject: Re: [NYLXS - HANGOUT] A simple perl script Message-ID: <20111215112733.GB17549-at-panix.com> References: <20111214070833.GA11058-at-panix.com> <1323908859.93530.YahooMailNeo-at-web38006.mail.mud.yahoo.com> <20111215045925.GA2102-at-horacrux> <1323928459.1868.YahooMailNeo-at-web38005.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1323928459.1868.YahooMailNeo-at-web38005.mail.mud.yahoo.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: owner-hangout-at-mrbrklyn.com Precedence: bulk Reply-To: hangout-at-mrbrklyn.com
On Wed, Dec 14, 2011 at 09:54:19PM -0800, Elfen Magix wrote: > I was thinking of Grep as well. >
you can perldoc the perl grep function or just use a regex test
next CLOSE_CHAPTER if m"Chapter \d\d"
or something like that. I'm rusty.
> The problem is simple (maybe not): > -Its a story text file in acsii. > -It has many chapters > -The chapter index numbers 1 - 13 are fine, skips 14, and continues with 15 to 75. > -The format of the chapter line (all 75 are in 1 file) is: > "Chapter XX: Chapter Name" Where XX is any number from 0 - 9, counting all 75 chapters. > > I was thinking of grep to find the chapter lines (which I can do and does work) but changing the numbers is what I cant figure out. > > grep 'Chapter' /file name? - gets the chapter lines and posts them. But changing them? > > BTW- I can remove chapters 1 - 13 temporarily while this change happens. > > > ________________________________ > From: Kevin Mark > Subject: Re: [NYLXS - HANGOUT] A simple perl script > > On Wed, Dec 14, 2011 at 04:27:39PM -0800, Elfen Magix wrote: > > I need a simple thing that goes through a file to find "Chapter [and a number] > > ". Then it must increment that number by 1 and resave the file without altering > > nothing else. > > > > I know I've seen this, and even wrote one years ago myself, but I cant for the > > life of me remember how! > > > > Thanks. > That is sort-of a loose definition for a program specification. > if its one line in one file, you can just open it in vi and search for it and fix it. > if you need it done in 10's or 100's of places, if might be a few lines of sed, awk or grep. > > grep "Chapter" filename
|
|