Script to split a text document by page count? (Perl, applescript)

by the way, is the ./ the command to invoke any Perl script, or is this something specific to this?

Beowulff: I tried it completely stripped down:

Same thing: two files, one empty, one a repeat of the original.

ARGH!!!

What was I doing wrong with the “line_no” command?

If this is what you typed, it assumes that the file is at the root of your hard drive - is it?
You need to specify the full path to the file, which is what the dragging and dropping does.

I’ve done it both ways, I was getting directory problems at first and sorted that out. It won’t do anything at all if it can’t find it. As long as it’s doing something, even if it’s wrong, I know that the directory isn’t the problem.

One issue may be line endings. Unix expects linefeed "
". If you are using <cr>, then you might have problems with csplit.

If you want to PM me and send me the file, I can try it over here.

I mean absolutely no offense whatsoever… but can I blow you now? (I’m a woman, in case that helps. )

YOU RULE!!!

That was the problem!!! WOOHOO!!!

I just saved it with Unix line endings via TextWrangler, and VOILA!

Now I have to try the rename script… WOOHOO

(That is an enormously important thing for me to understand for future reference… awesome. YAY!)

Part one is finally working. So now I’m trying to get your script working (which is a wonderful thing because it is based on the ACTUAL contents of the file, not the assumed contents, which my long-way-round is, and could screw up) and this is what’s happening so far…

Because I am so incredibly clueless about all this, I didn’t know for sure where to put the rename_files script, I assumed it should be in the same folder as the split files, so that’s where it is.

and my files are indeed named xxdigitdigit, so I also assume your xx* means “all the files starting with xx” teh asterisk being a wildcard.

I’m so close…

Glad that I could help.
As far as blowjobs go…let me ask my wife.

<Hon, I just helped some chick on the SDMB, and she wants to show her gratitude in a very special way - is that OK?>

Sorry, Stoid, I’m afraid that my wife says that BJs are just not an acceptable form of gratitude indication. But, I really appreciate the thought.:stuck_out_tongue:

./ tells it to run a command in the current directory. If you have ‘.’ in your PATH, then it’s unnecessary. However, a lot of UNIX-based systems don’t have ‘.’ in the PATH for security reasons. I have no clue what OS X does.

Actually, I think you’re done. Once you did the chmod 755 and ran it again, it looks like it worked. Do an ‘ls’ and see what the directory looks like now. Once it worked, it gave you an error when you tried it again as all the xx files had been renamed.

Sad to say, nope.

I ran the script through some debug tools and the same errors kept coming back. The syntax was ok, but it keeps spitting out the line 8 issue, saying:

“Error reading xx: No such file or directory at ./rename_files.pl line 8.”

I only get the error when I try it with xx standing alone. When I put xx* it does nothing, no error, no changes, nothing. See: (I tried renaming the docs rrdoc and adding the extension… just in case.)

Huh. It looks like it’s running, but it’s not picking up the photo URLs to allow it to determine the new filename. It’s specifically looking for something like:
HREF=“photos/*****.jpg”
(where ***** represents arbitrary text).

If your photo links are different, then it won’t pick up the filename. It seemed to work okay when I tested it with the sample page you posted.