If none of the filenames contain spaces(!), you can write a regexp to match the end of the line using the $ anchor, e.g.
perl -p -e '/([^ ]+)$/; print "rm -f $1\n";' < files-to-delete.txt Harold On Wed, Jun 30, 2010 at 3:01 PM, David Spencer, Internet Handyman <spen...@pageweavers.com> wrote: > Guys, I'm sorry about asking this on the list; but I seem to have a mental > block when it comes to regular expressions. Here's what I'm trying to do: > > I have a lot of directories with a vast number of files, some of which I wish > to delete based on the month they were created. I've built a file from some > full directory listings that has all the files I wish to delete. (Just go with > me on this and don't suggest alternative methods of performing the task - I'm > simplfying the job so it can be explained more easily.) > > A snippet of the file would look like this: > > -rw------- 1 auser auser 3.7K Apr 12 10:11 auser/folder/new/127109228.file > -rw------- 1 auser auser 16K Apr 12 12:32 auser/folder/new/127110076.file > > I would like to write either single-line perl command or a nano search and > replace to substitute the directory info and replace it with a file delete > so it would look like this: > > rm -f auser/folder/new/127109228.file > rm -f auser/folder/new/127110076.file > > Then I can just execute converted directory file as a shell script and > delete my files. But I'm having a brain-freeze on what a valid regex would > look like to match. Help?? > > Thanks again, > > > -- Dave Spencer, PageWeavers > _______________________________________________ > vox-tech mailing list > vox-tech@lists.lugod.org > http://lists.lugod.org/mailman/listinfo/vox-tech > _______________________________________________ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech