[ale] THANKS to all who replied to "ls -rt | rm -i" problem, BUT...

Joe Knapka jknapka at kneuro.net
Fri Mar 17 10:33:18 EST 2006


Geoffrey wrote:
> Joe Knapka wrote:
> 
>>Hi Courtney,
>>
>>This worked for me just now, to interactively
>>remove files modified on March 15:
>>
>>rm -i $(ls -l | grep 'Mar 15' | cut -d ' ' -f 9)
> 
> 
> rm -i $(ls -l |awk '/Mar 15/ {print $NF}'
> 
> Will save you a WHOLE pipe and a process!

Oh well. The machine will happily execute either one,
and I doubt it will care ;-)   Plus, I don't know
awk, so the latter part of your command is
somewhat mysterious to me. Especially the part
where you omit the trailing paren; why does
that work?

> Be aware that file names with spaces in them will screw up your efforts. :(

That's a serious issue, and an excellent reason
to prefer your solution. I never put spaces in
filenames, and usually if someone sends me a file
with a space in the name, I write that person out
of my will at once.

-- JK




More information about the Ale mailing list