[ale] FINAL ANSWER to --> "ls -rt | rm -i" problem

Courtney Thomas cc.thomas at earthlink.net
Sat Mar 18 16:52:52 EST 2006


For those who care  :-)

	rm -id  $(ls -l|grep 'Mar  7'|cut -c54-80)

will interactively present files/directories... by name and by the 
command's date... for deletion.

Again, my appreciation to all participants,

Courtney


Paul Cartwright wrote:
> On Sat March 18 2006 3:16 pm, Joe Knapka wrote:
> 
>>"cut" is really a crummy tool for this IMO; there's
>>lots of ways it might screw up if the "ls" output
>>varies, which it does (for example, if the width
>>of a field varies, there might be different numbers
>>of fields per line, since "ls" will insert spaces
>>to make the columns line up). What's needed is really
>>something like Python's or Tcl's "split" function,
>>which considers any contiguous group of whitespace
>>characters to be a field delimiter.  I'm not aware
>>of a shell function that does the same thing, but
>>there probably is one.
> 
> 
> rather than using a field as the delimiter, if you cut by characters, 
> starting at 54, you get all the filenames complete:)
> like this
>  ls -l | cut -c54-80
>  



More information about the Ale mailing list