08-15-2008
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories.
The following command also shows the files but I only want to see the directories.
ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies
2. Shell Programming and Scripting
Hi All,
I need a solution on my following find command
find ./.. -name '*.file' -print
BTW This gives me the output as belows
./rtlsim/test/ADCONV0/infile/ad0_dagctst.file
./rtlsim/test/ADCONV0/user_command.file
./rtlsim/test/ADCONV0/simv.daidir/scsim.db.dir/scsim.db.file... (2 Replies)
Discussion started by: user_prady
2 Replies
3. Shell Programming and Scripting
Hi,
I am new to perl:
I need to write perl script to list all the files present in directory and mail should be come to my inbox with all the files present in that directory.
advanced thanks for valuable inputs.
Thanks
Prakash GR (1 Reply)
Discussion started by: prakash.gr
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
Please let me know how to find out number of files in a directory excluding existing files..The existing file format will be unknown..each time..
Thanks (3 Replies)
Discussion started by: ammu
3 Replies
5. UNIX for Dummies Questions & Answers
HI All,
At present in my server the log folder was filled up and causing memory issue.
So I am planning to write a script in such a way that the files which are older than 30 days will be deleted and also need to find the files which were not compressed and need to compress this file.... (4 Replies)
Discussion started by: arumilli
4 Replies
6. UNIX for Dummies Questions & Answers
I am running Ubuntu 11.10
I have the following files.
geo2503r05690585.html
geo2503r06020612.html
geo2503r06250641.html
geo2503r06490658.html
geo2503r06830686.html
geo2503r05860601.html
geo2503r06130624.html
geo2503r06420648.html
geo2503r06590682.html ... (4 Replies)
Discussion started by: kristinu
4 Replies
7. Shell Programming and Scripting
Hi,
I have a folder which contains files in this format.
abc-bin.000001
abc-bin.000002
abc-bin.000003
abc-bin.000004
abc-bin.000005
abc-bin.000006
abc-bin.000007
abc-bin.000008
abc-bin.000009
abc-bin.000010
abc-bin.index
I want to copy all the files between
abc-bin.000004... (6 Replies)
Discussion started by: arijitsaha
6 Replies
8. UNIX for Advanced & Expert Users
Find all files in the current directory only excluding hidden directories and files.
For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided.
`find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies
9. Shell Programming and Scripting
Hi,
I want to display the file names and the record count for the files in the 2nd column for the files created today.
i have written the below command which is listing the file names. but while piping the above command to the wc -l command
its not working for me.
ls -l... (5 Replies)
Discussion started by: Showdown
5 Replies
10. Shell Programming and Scripting
Hii,
Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories.
Eg.
file1: test1.log
file2: test2.log
file3 test.zip
After running the script
file1: string_test1.log
file2: string_test2.log
file3:... (4 Replies)
Discussion started by: Ravi Kishore
4 Replies
LEARN ABOUT MOJAVE
regexp::common::list5.18
Regexp::Common::list(3) User Contributed Perl Documentation Regexp::Common::list(3)
NAME
Regexp::Common::list -- provide regexes for lists
SYNOPSIS
use Regexp::Common qw /list/;
while (<>) {
/$RE{list}{-pat => 'w+'}/ and print "List of words";
/$RE{list}{-pat => $RE{num}{real}}/ and print "List of numbers";
}
DESCRIPTION
Please consult the manual of Regexp::Common for a general description of the works of this interface.
Do not use this module directly, but load it via Regexp::Common.
$RE{list}{-pat}{-sep}{-lastsep}
Returns a pattern matching a list of (at least two) substrings.
If "-pat=P" is specified, it defines the pattern for each substring in the list. By default, P is "qr/.*?S/". In Regexp::Common 0.02 or
earlier, the default pattern was "qr/.*?/". But that will match a single space, causing unintended parsing of "a, b, and c" as a list of
four elements instead of 3 (with "-word" being "(?:and)"). One consequence is that a list of the form "a,,b" will no longer be parsed. Use
the pattern "qr /.*?/" to be able to parse this, but see the previous remark.
If "-sep=P" is specified, it defines the pattern P to be used as a separator between each pair of substrings in the list, except the final
two. By default P is "qr/s*,s*/".
If "-lastsep=P" is specified, it defines the pattern P to be used as a separator between the final two substrings in the list. By default
P is the same as the pattern specified by the "-sep" flag.
For example:
$RE{list}{-pat=>'w+'} # match a list of word chars
$RE{list}{-pat=>$RE{num}{real}} # match a list of numbers
$RE{list}{-sep=>" "} # match a tab-separated list
$RE{list}{-lastsep=>',s+ands+'} # match a proper English list
Under "-keep":
$1 captures the entire list
$2 captures the last separator
$RE{list}{conj}{-word=PATTERN}
An alias for $RE{list}{-lastsep=>'s*,?s*PATTERNs*'}
If "-word" is not specified, the default pattern is "qr/and|or/".
For example:
$RE{list}{conj}{-word=>'et'} # match Jean, Paul, et Satre
$RE{list}{conj}{-word=>'oder'} # match Bonn, Koln oder Hamburg
$RE{list}{and}
An alias for $RE{list}{conj}{-word=>'and'}
$RE{list}{or}
An alias for $RE{list}{conj}{-word=>'or'}
SEE ALSO
Regexp::Common for a general description of how to use this interface.
AUTHOR
Damian Conway (damian@conway.org)
MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be).
BUGS AND IRRITATIONS
Bound to be plenty.
For a start, there are many common regexes missing. Send them in to regexp-common@abigail.be.
LICENSE and COPYRIGHT
This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail.
This module is free software, and maybe used under any of the following licenses:
1) The Perl Artistic License. See the file COPYRIGHT.AL.
2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2.
3) The BSD Licence. See the file COPYRIGHT.BSD.
4) The MIT Licence. See the file COPYRIGHT.MIT.
perl v5.18.2 2013-03-08 Regexp::Common::list(3)