On Wed, Nov 14, 2001 at 12:25:15PM -0800, Harry Putnam wrote: > > Both: > s#Mail/sent## > and > `ls ~/mail | grep -v '^sent'` > Will fail in the event of filenames like `unsent' or `notsent'
????? the "^" before "sent" searches for the beginning of the line. It will not fail for `unsent' or `notsent' but for `sentun' and `sentnot' . [seyman@munshine tmp]$ ll total 0 -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 bar -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 foo -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 notsent -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 sent -rw-rw-r-- 1 seyman seyman 0 nov 15 01:06 sentnot -rw-rw-r-- 1 seyman seyman 0 nov 15 01:06 sentun -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 titi -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 toto -rw-rw-r-- 1 seyman seyman 0 nov 15 01:05 unsent [seyman@munshine tmp]$ ls ~/tmp | grep -v '^sent' bar foo notsent titi toto unsent Completing the line like this (as I did in my script): ls ~/tmp | grep -v '^sent$' makes sure that only the file `sent' is excluded. [seyman@munshine tmp]$ ls ~/tmp | grep -v '^sent$' bar foo notsent sentnot sentun titi toto unsent As for sed s#Mail/sent##, it will filter out only the first sent and will definatly not react to `unsent' or `notsent' [seyman@munshine seyman]$ ll tmp/* -rw-rw-r-- 1 seyman seyman 0 nov 15 01:24 tmp/notsent -rw-rw-r-- 1 seyman seyman 0 nov 15 01:21 tmp/sent -rw-rw-r-- 1 seyman seyman 0 nov 15 01:21 tmp/sent. -rw-rw-r-- 1 seyman seyman 0 nov 15 01:21 tmp/senta -rw-rw-r-- 1 seyman seyman 0 nov 15 01:24 tmp/unsent [seyman@munshine seyman]$ echo tmp/* | sed s#tmp/sent## tmp/notsent tmp/sent. tmp/senta tmp/unsent > >> ls Mail/[a-rt-z]* > >> It will show all files except those beginning with `s' > > > > As I said in my first message, close but not close enough. > > Really?.. All I see is: > `echo [^sent]*` > `echo [^s]*` > > I see no examples of `ls' at all. My "close but not close enough" refers to the "It will show..." line, not the one directly above it. I assure you that [^s]* is equivalent to [a-rt-z]* except in regards of it really showing all files except those beginning with `s' (even those starting with capitals or digits). Please don't take any notice of ls vs echo. The idea is to show all the filenames except sent, which these commands both do. The differences are details. > Can you show an example of what gets included with above > `ls [a-rt-z]*' syntax, > changing the name if need be, to something that conveys the problem? [seyman@munshine seyman]$ ll tmp/* -rw-rw-r-- 1 seyman seyman 0 nov 15 01:27 tmp/Bar -rw-rw-r-- 1 seyman seyman 0 nov 15 01:27 tmp/Foo -rw-rw-r-- 1 seyman seyman 0 nov 15 01:30 tmp/bar -rw-rw-r-- 1 seyman seyman 0 nov 15 01:30 tmp/foo -rw-rw-r-- 1 seyman seyman 0 nov 15 01:27 tmp/sent [seyman@munshine seyman]$ ls tmp/[a-rt-z]* tmp/bar tmp/foo Emmanuel _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list