[lug] scripting on linux to replace "find and replace"

John Starkey jstarkey at advancecreations.com
Tue Sep 26 10:50:06 MDT 2000


It's scary how close the thread is to the grep thread, both issues
(related to using grep) coming up the same day.

I have one weekly job that involves 70 files as a simple slide show. These
will be broken down into groups of 10 (approx.). Normally when I'm coding
(html) this many files I'll go to a land of Windoze cubicles and use
HomeSite due to it's find and replace abilities. I do this knowing well
enough that Linux can do a hell of a lot better job but I can't find the
time to get into shell scripting. It's one of those investments that
I know will pay off but, like today, I have to have 70 files uploaded by
tomorrow morning at the very latest.

So with that said, is there anyone with a vengance against Windoze that
could help with a couple scripts. If I can pull this off it'd make a great
argument against Windoze at work. Where someone said just last week "yea
but look at what Bill has done for the world".  

1) I need to create 70 files, all identical except for 2 numbers in the
<img> tag. These two numbers need to increment relative to the file name
(file1 -> <img src="001">; file2 -> <img src="002>) ( a slide show ).

2) When the client sends the layout I'll need to break these 70 files down
into groups and rename both the files and images (140 files at this
point). I could probably work this without changing the names.

3) Certain files will need navigation buttons. So I'll need to specify
which file and where in the file to place these buttons. 

I estimate 4 hours to do all this in HomeSite. I have a feeling this can
be done in less than an hour in Linux.

What confuses me the most is the xargs (Build and execute command line
from standard input)?? Does this mean you make the file stdin and execute
the commands from what the file returns?? Why not just ./scriptfile and
get it over with.

Thanks,

John






More information about the LUG mailing list