[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need scripting or redirection help in BASH



On Mon, 07 Jan 2002 07:40:45 -0500, Kurc, Marcin A. wrote:

>#!/bin/bash
>for i in $(ls -l ./ |grep "Dec  21" | awk '{print $9}');
>    do
>	  rm -rf $i
>done			
>
>btw, check out http://www.linuxdoc.org/HOWTO/Bash-Prog-Intro-HOWTO.html and
>http://www.linuxdoc.org/LDP/abs/html/
>

>>Subject: Need scripting or redirection help in BASH
>>
>>
>>... in pseudo code:
>>
>>for x in ( ls -l | grep "Dec 21" )
>>    do 
>>        rm x( suitably parsed )
>>    done
>>exit 
>>
>>
Thanks Kurc, Alvin, David and David

Kurc, tnx for the script.  I had no idea I was so close.  I will
bookmark your homework suggestion and get to it as soon as possible.

Alvin, warnings are appreciated and I will double check the filenames.

David, there is an elegance to your use of 'find' and I will RTFMan
find.  See next comment.  

David also, in this case, the controlling parm is the date.  My home
directory is very small and familiar at this time, so  no, I don't
expect 'c' files.

Thanks again, guys.  This has been helpful well beyond my simple
question.

gt
Yes I fear I am living beyond my mental means--Nash



Reply to: