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

RE: Need scripting or redirection help in BASH



#!/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/

Marcin Kurc
CAD Systems Administrator
Cooper-Standard Automotive 

-----Original Message-----
From: Gary Turner [mailto:kk5st@swbell.net]
Sent: Monday, January 07, 2002 3:02 AM
To: debian-user@lists.debian.org
Subject: Need scripting or redirection help in BASH


A day or two ago, I noticed that somewhere in my effort to get
acquainted with my Debian box, a few hundred files of type 'c'
(character, as opposed to regular or block) had shown up in my home
directory.  All were created 12/21/01.  My wish is to be rid of them.  I
did:

$ ls -l | grep "Dec 21" | less

and inspected the lot.  There should be a way to delete these files
using grep and redirection/piping or a shell script.  My thought is some
kind of iterative script, in pseudo code:

for x in ( ls -l | grep "Dec 21" )
    do 
        rm x( suitably parsed )
    done
exit 

I haven't even begun to take on sh, bash, perl or any other scripting
language yet.  So I would really appreciate some help on this.

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


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org



Reply to: