> Greetings folks..this is my first post and i hope i'm doing this
> correctly.
So far, so good.
Quote:> Here is my problem:
> ls -lrt /bs/processing/* >> jess1.txt
Are you sure this is what you want? This will list the contents of
subdirectories, if any, as well as the contents of /bs/processing.
If you don't want that, add the -d option.
Quote:> This part of my script is fine. It pulls all of the data in the
> directory and places it in a txt file.
> However, i want to pull only the current dates data (IE: Today)
> I thought i could use this but its not working:
> dateM='date | cut -c 5-10'
Two things: first, to get the output of a command, use backticks,
not apostrophes:
dateM=`date | cut -c 5-10`
Second, you can get the portions directly with the date command.
There's no need for cut (although, if you're using a Bourne shell,
it may be the quickest way):
If you have GNU date:
dateM=`date "+%h %_d"`
Otherwise (assumes a POSIX shell):
eval `date "+month=%h day=%d"`
case $day in
0?) day=" ${day#?}" ;;
esac
dateM="$month $day"
Quote:> cat jess1.txt ls -lartR |grep "$dateM" >> jess2.txt
You can do it without a temporary file:
ls -d -lrt /bs/processing/* | grep "$dateM" > FILE.txt
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License