I've looked in this group for an FAQ hoping to find something to use but
to no avail. I'm on BSD Unix using csh as my shell. I have a directory of
numerous files that get updated frequently and I'd like to copy only
those files matching a command-line argument (such as "Apr 27") to
another directory.
This seems like such a trivial task, and I'm close to a solution, but
it's not quite working.
I've approached it from 2 directions. I don't care which one the solution
addresses. I just need *help* :-)
1) I can get a list of filenames quite easily using the following script:
#!/bin/csh -f
ls -l ~/myhtml/*.html | grep "$1" >! today.list
cut -c68-90 today.list >! names.list
cat names.list
However, this presents me with the problem of looping through this file
and processing each line. I don't know enough about awk, perl, or sed to
do this.
2) The other attempt is a shell script as follows:
#! /bin/csh
# update version 6
# Copy files matching command line argument (usually date).
foreach file (`ls -l ~/myhtml/*.html | grep $1`)
cp $file ~/in/
cp $file ~/public_html/
end
This doesn't work. If anyone can help I would *really* appreciate it.
Email direct would be preferable. Thanks in advance and bcnu...
--
May the fire be your friend, may the sea rock you gently,
May the moon light your way, 'til the wind sets you free. - Shriekback
| P.O. Box 1538, London ON, N6A 5M3 |
| Voice: (519) 438-5887 |
+=============Practice safe hex ... wear a write-protect tab=============+