Sponsored Content
Top Forums Shell Programming and Scripting ls -l /directory/path | grep -f filter.txt NOT WORKING Post 302648503 by wolf@=NK on Wednesday 30th of May 2012 03:42:53 AM
Old 05-30-2012
Question ls -l /directory/path | grep -f filter.txt NOT WORKING

Hi,

I have been searching all over and cannot find a script or command that simply search or match the filenames listed in a file and match it from a directory.

so far,

example:

Code:
cat filter.txt
file1.def
file2.conf
file3.def
 
ls -l /directory | grep -f filter.txt


Last edited by Scott; 05-30-2012 at 04:51 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help--script to filter specific lines from multiple txt files

Hi folks, - I have 800 txt files - those files are cisco router configs router1.txt router2.txt ... router800.txt I want to accomplish the following: - I want to have a seperate file with all the filenames that I want to process - I want a script that goes trough all those... (7 Replies)
Discussion started by: I-1
7 Replies

2. Shell Programming and Scripting

how do I filter double lines from a txt file

Hi, I have a file with the following: access-list.txt router1 access-list 1 permit any any access-list 1 deny any any router2 access-list 2 permit any any access-list 2 deny any any router3 access-list 3 permit any any access-list 3 deny any any I want to hava an output that... (10 Replies)
Discussion started by: I-1
10 Replies

3. Shell Programming and Scripting

sed to read x.txt and grep from y.txt

How would I write a command(s) to read from a file (list) that looks like this: 29847374384 and grep from a second file (list) that looks like this: 29847374384, jkdfkjdf,3833,ddd:confused: (1 Reply)
Discussion started by: smellylizzard
1 Replies

4. UNIX for Dummies Questions & Answers

Present Working Directory (not the full path)

Hi, Is there a command that tells you right away the current working directory? I know the command "pwd", but that one gives the full path. if pwd gives me: /a/b/c/d/ggg/HERE I want something that will give me: HERE Thanks, Gaurab (13 Replies)
Discussion started by: gaurab
13 Replies

5. Shell Programming and Scripting

"find . -printf" without prepended "." path? Getting path to current working directory?

If I enter (simplified): find . -printf "%p\n" then all files in the output are prepended by a "." like ./local/share/test23.log How can achieve that a.) the leading "./" is omitted and/or b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies

6. Shell Programming and Scripting

Filter specified path

We have 10 jobs entry in crontab like this 0 7 * * 0 && (source /x/y/z .bashrc ; /x/y/z /test.sh Table1 /ABC/TEST >x/y/z/log (every job have different o/p Path) can any one help me to filter only the output PATH /ABC/TEST from the file dup_cron. (1 Reply)
Discussion started by: netdbaind
1 Replies

7. UNIX and Linux Applications

Ssmtp -t < /path/to/the/message.txt (How to format message.txt for html email)

ssmtp has been running well under Kubuntu 12.04.1 for plain text messages. I would like to send html messages with ssmtp -t < /path/to/the/message.txt, but I cannot seem to get the message.txt file properly formatted. I have tried various charsets, Content-Transfer-Encoding, rearranging the... (0 Replies)
Discussion started by: Ronald B
0 Replies

8. Shell Programming and Scripting

Help with shell script - filter txt file full of ips

Hello again gentlemen. I would like to make a shell script to 'optimize' a plain text full of IPs. Let's suppose to have this text file: 1.192.63.253-1.192.63.253 1.0.234.46/32 1.1.128.0/17 1.116.0.0/14 1.177.1.157-1.177.1.157 1.23.22.19 1.192.61.0-1.192.61.99 8.6.6.6 I want to... (2 Replies)
Discussion started by: accolito
2 Replies

9. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

10. UNIX for Beginners Questions & Answers

What is the difference ../directory path and ./directory path in ksh?

What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
Test::Fixme(3pm)					User Contributed Perl Documentation					  Test::Fixme(3pm)

NAME
Test::Fixme - check code for FIXMEs. SYNOPSIS
# In a test script like 't/test-fixme.t' use Test::Fixme; run_tests(); # You can also tailor the behaviour. use Test::Fixme; run_tests( where => 'lib', # where to find files to check match => 'TODO', # what to check for skip_all => $ENV{SKIP} # should all tests be skipped ); DESCRIPTION
When coding it is common to come up against problems that need to be addressed but that are not a big deal at the moment. What generally happens is that the coder adds comments like: # FIXME - what about windows that are bigger than the screen? # FIXME - add checking of user priviledges here. Test::Fixme allows you to add a test file that ensures that none of these get forgotten in the module. Arguments By default run_tests will search for 'FIXME' in all the files it can find in the project. You can change these defaults by using 'where' or 'match' as follows: run_tests( where => 'lib', # just check the modules. match => 'TODO' # look for things that are not done yet. ); where Specifies where to search for files. This can be a scalar containing a single directory name, or it can be a listref containing multiple directory names. match Expression to search for within the files. This may be a simple string, or a qr//-quoted regular expression. For example: match => qr/[T]ODO|[F]IXME|[B]UG/, filename_match Expression to filter file names. This should be a qr//-quoted regular expression. For example: match => qr/.(:pm|pl)$/, would only match .pm and .pl files under your specified directory. HINTS
If you want to match something other than 'FIXME' then you may find that the test file itself is being caught. Try doing this: run_tests( match => 'TO'.'DO' ); You may also wish to suppress the tests - try this: use Test::Fixme; run_tests( skip_all => $ENV{SKIP_TEST_FIXME} ); You can only run run_tests once per file. Please use several test files if you want to run several different tests. SEE ALSO
Devel::FIXME AUTHOR
Edmund von der Burg <evdb@ecclestoad.co.uk> Please let me know if you have any comments or suggestions. <http://ecclestoad.co.uk/> ACKNOWLEDGMENTS
Dave O'Neill added support for 'filename_match' and also being able to pass a list of several directories in the 'where' argument. Many thanks. LICENSE
Copryight (C) 2008 Edmund von der Burg "<evdb@ecclestoad.co.uk"> This library is free software . You can redistribute it and/or modify it under the same terms as perl itself. perl v5.10.0 2009-03-12 Test::Fixme(3pm)
All times are GMT -4. The time now is 03:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy