MESSAGE
DATE | 2011-12-15 |
FROM | Kevin Mark
|
SUBJECT | Re: [NYLXS - HANGOUT] A simple perl script
|
On Wed, Dec 14, 2011 at 09:54:19PM -0800, Elfen Magix wrote: > I was thinking of Grep as well. > > 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. here is what I'd do: I try to find all of the count lines and see which chapter numbers where missing and then try to renumber the chapters accordinly like this: chapter 1 -> chapter 1 chapter 2 -> chapter 2 chapter 4 -> chapter 3 chapter 6 -> chapter 4
-- | .''`. == Debian GNU/Linux ==.| http://kevix.myopenid.com......| | : :' : The Universal OS....| mysite.verizon.net/kevin.mark/.| | `. `' http://www.debian.org/.| http://counter.li.org [#238656]| |___`-____Unless I ask to be CCd,.assume I am subscribed._________|
Blackout, heatwave, .44 caliber homicide, The bums drop dead and the dogs go mad in packs on the West Side, A young girl standing on a ledge, looks like another suicide, She wants to hit those bricks, 'cause the news at six got to stick to a deadline, While the millionaires hide in Beekman place, The bag ladies throw their bones in my face, I get attacked by a kid with stereo sound, I don't want to hear it but he won't turn it down... -- Billy Joel, "Glass Houses"
|
|