how to search and list file with wildcard character


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to search and list file with wildcard character
# 1  
Old 06-27-2010
MySQL how to search and list file with wildcard character

hi,

I want to search all files in the current working direcotry and to print in comma (,) seperated output. But I have two patterns to search for.

Files will be in ABC20100508.DAT format.

Search should happen on the format (ABC????????.DAT) along with date(20100508).

I can do a
Code:
ls -ltrdm ABC????????.DAT

to list the file with the defined format but I am not able to do a date check.

Code:
ls -ltrdm ABC????????.DAT | ls 20100508

Above one is not working.

Any soultion is highly appreciated.
# 2  
Old 06-27-2010
BY date do you mean when the file was last written to?
Code:
touch -t 201050800000 dummy
touch -t 201005082359 dummy1
find /path/to/files -name ABC????????.DAT  \( -newer dummy -a ! -newer dummy1 \) -exec ls -l {} \;

# 3  
Old 06-28-2010
--

Hi,
I mean, If the date is present in the file name.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep and BzGrep with Wildcard in Search Pattern

Hello All, I hope this is the right area. If not, Kindly let me know and I will report in the appropriate spot. I am needing to find a search pattern that will make the * act as Wildcard in the search pattern instead of being literal. The example I am using is bzgrep "to=<*@domain.com>"... (5 Replies)
Discussion started by: mancountry
5 Replies

2. Shell Programming and Scripting

Wildcard search in if loop

Practice folder contains many files and im interested in extracting file which starts with abc* ghi* xyz* . I need to do variety of operations for different files. if file starts with xyz* then i need to move to some destination otherwise some other destination. I am not able to make wildcard... (15 Replies)
Discussion started by: kumaar1986
15 Replies

3. Shell Programming and Scripting

WildCard character - not able to understand

Hello, I have one script which looks as given below , . ${0%/*}/init && init_job || exit 1 what I understood is , 1. above syntax has three commands, two on left of || and one on right of ||. 2. ${0%/*} would generate some path. Question. A. What is the meaning of ${0%/*} ,... (2 Replies)
Discussion started by: ParthThakkar
2 Replies

4. Shell Programming and Scripting

Search a wildcard text in a file

Hi, I have a file(report.txt) that contains : 0 1 chk_uncov_data_assert 776 chk_uncov_data_assert : assert property (chk_uncov_data) 1 0 chk_data_assert 772 chk_data_assert : assert property (chk_data) 1 0 chk_data_cover ... (8 Replies)
Discussion started by: Anamika08
8 Replies

5. Shell Programming and Scripting

Grep Wildcard search

How can i grep for a pattern with wildcard using grep? I want to identify all the lines that start with SAM and end in .PIPE IN.TXT SAM_HEADER.PIPE SAM_DETAIL.PIPE SAM_INVOICE.PIPE Can i do something like grep SAM*.PIPE IN.TXT (2 Replies)
Discussion started by: venky338
2 Replies

6. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

7. UNIX for Advanced & Expert Users

Unix wildcard character question

1. Is . wildcard? , the documented wildcard are "*", "?", and "" . seems mean everything, the follwing cmd will copy everything cp -r /tmp/test1/. /tmp/test2/ However it doesn't work for rm, why? $ ls -a . .. .a .aa aa t2 $ rm -rf . $ ls -a . .. .a .aa ... (3 Replies)
Discussion started by: honglus
3 Replies

8. Shell Programming and Scripting

Fastest way to list a file in a folder containing 800,000 files using wildcard

Hi, I have a directory with possibly around 800,000 files in it. What is the fastest way to list file(s) in this directory with a wildcard. for example would ls -1 *.abcdefg.Z or find . -name "*.abcdefg.Z" be the fastest way to find all of the files that end with .abcdefg.Z... (6 Replies)
Discussion started by: jerardfjay
6 Replies

9. Shell Programming and Scripting

Search for a non zero character in file

Hi, I have a log file which has entries as Staged 0 records from fn.dat (0 failed) 01/01 01:01:01 I 0 Error Transactions I want to find out any line that has an entry like "(1 failed)" or "(2 failed)" or any number in general ( >0 ) similarly it should search for string like "1... (4 Replies)
Discussion started by: misenkiser
4 Replies

10. Shell Programming and Scripting

Single character wildcard for SED

Could someone tell me the single character wildcard for SED? I have the file below: $ more input2 AAA /A/B/C BBB /D/E/F CCC /G/H/I DDD I want to remove all strings which contain forward slashs "/" to get the below: AAA BBB CCC I tried to do it in SED by the command below but I... (8 Replies)
Discussion started by: stevefox
8 Replies
Login or Register to Ask a Question