[ale] When a script is necessary, and when a piped command is sufficient ?

Courtney Thomas cc.thomas at earthlink.net
Wed Mar 15 09:44:04 EST 2006


I've been trying to assemble a sequence of actions, e.g. find, sort, rm, 
etc.... to filter a directory of files and have not yet succeeded.

In particular I need to execute, in the following sequence;

	1-find or ls
	2-sort [by file date]
	3-rm [interactively]

I'd prefer a prompted command sequence rather than a script.

For example...

	ls -l | sort +5

will print out the dir sorted by file date but I then need to rm certain 
files of a certain date, that HAS been sorted out by the above, the sort 
for putting all the files I want to remove in a contiguous sequence so 
that I can page through the others to that point quickly and 
interactively, to make sure I don't delete anything unintentionally.

I've briefly and unsuccessfully attempted to pipe this into some sort of 
"rm" operation from the command line, but failed.

I guess I could tar the directory and then filter it as a file or just 
filter the dir from the command line, which would seem to be less 'safe' 
and maybe for prototyping the command(s) should tar the dir,... at least 
until the commands are safely tested,... and be the wise way to go.

Anyway, I'd gratefully accept suggestions to quickly resolve this, as 
I've got outdoor projects backed up which I'd like to complete 'fore it 
gets hot  :-) and would like to avoid devoting more time to this, for now.

Appreciatively,
Courtney



More information about the Ale mailing list