![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| listing files excluding files from control file | ukatru | UNIX for Advanced & Expert Users | 15 | 08-15-2008 08:24 PM |
| Listing Files | krishna_sicsr | High Level Programming | 3 | 04-05-2007 01:32 PM |
| Listing of files | Vitalka | Linux | 1 | 03-02-2005 09:32 AM |
| help - listing files | richarmj | Filesystems, Disks and Memory | 2 | 10-02-2003 09:14 AM |
| Recursive directory listing without listing files | psingh | UNIX for Dummies Questions & Answers | 4 | 05-10-2002 10:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Listing all the files names not starting as
hello all,
iam new to shell scripting.I have searched the forum and could'nd find a close enough answer and hence this post: I want to list all the file names whose names don't start as abc. For example if my folder constains files with names: abc123.txt,erdf23.rdf,ed45r.fmb i want a command which will list only files erdf23.rdf,ed45r.fmb and omit the file abc123.txt. the ls command does'nt seem to have a -not option |
|
||||
|
Quote:
i mean don't select files whose name starting with abc or efg ls -ld !(abc*,efg*)|awk '!/^d/{print $NF}' don't seem to work |
|
||||
|
Quote:
I do this: FILELIST=`ls -l |awk '/^-/ && $NF !~ /^abc/ && $NF !~ /^efg/ && $NF ~ /.out/ {print $NF}'` echo $FILELIST Neither does this work: FILELIST=`echo ls -l |awk '/^-/ && $NF !~ /^abc/ && $NF !~ /^efg/ && $NF ~ /.out/ {print $NF}'` echo $FILELIST Please help..Ideally it shold be printing the file name whose extension is .out and not begining with abc or efg |
|
||||
|
It should work, post the output of ls -l within code brackets.
Regards |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|