![]() |
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 Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find excluding the hidden files | arunkumar_mca | UNIX for Advanced & Expert Users | 3 | 01-27-2008 11:45 PM |
| search for files excluding binary files | user_prady | Shell Programming and Scripting | 2 | 09-05-2007 12:18 AM |
| Excluding files using tar cXzf | sampipe | UNIX for Dummies Questions & Answers | 11 | 07-28-2005 09:46 AM |
| Recursive directory listing without listing files | psingh | UNIX for Dummies Questions & Answers | 4 | 05-10-2002 10:52 AM |
| Excluding Old Files on AWK !!! | alexalvarenga | Shell Programming and Scripting | 2 | 01-16-2002 10:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
listing files excluding files from control file
I have a directory named Project.I have a control file which contains valid list of files.I would like list the files from directory Project which contains files other than listed in the control file.
Sample control file: TEST SEND SFFFILE CONTL The directory contains followign files: TEST SEND SFFFILE CONTL Link seq test param When i run a script it has to create a file with the following files. Link seq test param Please give me any suggestion how to do this .Control file contains more file and dir also contains more file.Please tell the efficient way to do this. Thanks |
|
||||
|
In the project directory I have the following files.
TEST_10 TeST_11 SEND_101 If i run that command it should not list these files also becuase they start with the value from the control file. it should not return TEST* files also. |
|
||||
|
Trivially, take out the -x option which requires the whole line to match, and add an -i option to make matching ignore case. However, that does not anchor searches to beginning of line, so e.g. a file named bestest will match the pattern test. Maybe you could accept a change to the control file format, to support full regular expressions? Then the control file should contain
Code:
^test ^send ^sfffile ^contl Code:
ls | awk 'NR==FNR { pat[++n] = "^" tolower($0); next; }
{ for (p in pat) if (tolower($0) ~ pat[p]) next; print }' ctlfile -
Last edited by era; 08-15-2008 at 02:44 AM.. Reason: Oops, mixing Perl and awk syntax |
|
||||
|
the below script is not returning any thing
ls | awk 'NR==FNR { pat[++n] = "^"$0; next; } { for (p in pat) if ($0 ~ pat[p]) next; print }' controlfile I have the follwoing entried in control file. TestFile I have the follwoing list of file in my directory. TestFile.ksh TestFile.dat test.TestFile I am using the following command ls | grep -vf controlfile this is not returning any thing becuase all the files matched tha patteren.But i am expecting it should return test.TestFile. How can i acheive this. Thanks |
|
||||
|
Your requirements are not clear; need to be precise about them or it all gets lost in translation...and please use code tags.
The entries in the control file should match only the name of the file but not the extension...correct?? |
|
||||
|
Here is the situation.I have control file which contains the following values.
TEST SEND SFFFILE CONTL The directory contains followign files: TEST SEND SFFFILE CONTL Link seq test paramTEST When i run a script it has to create a file with the following files. Link seq test paramTEST Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|