Wildcard in file names


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Wildcard in file names
# 1  
Old 01-01-2015
Wildcard in file names

I know this is very basic and looks strange to me .
Code:
-bash-3.2$ wc -l *.[a-z][a-z][A-Z]


Result:

51 test.bad


Since my third range after dot is A-Z(upper), how it matched the d( Lower)? i was in an understanding that the above code would not fetch any result unless i have a file with 3 char extension and ends with upper case ..

Note : I'm Just a learner

Last edited by Don Cragun; 01-01-2015 at 02:10 AM.. Reason: Remove extraneous text.
# 2  
Old 01-01-2015
What OS and filesystem type are you using? (If you don't know, what output do you get from the commands:
Code:
uname -a;mount

Some operating systems are case insensitive. Some filesystem types are case insensitive even on OSes that are case sensitive.
# 3  
Old 01-01-2015
it looks like this on first line ( could not post all the lines here).. and many nfs in the middle of content ...

Code:
Linux Some_server 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux


Last edited by saravana.sarak; 01-01-2015 at 02:48 AM.. Reason: updated
# 4  
Old 01-01-2015
Looks like redhat el5. Probably it is the collating order of your locale setting that makes A-Z include lowercase characters

Try either:
Code:
wc -l *.[[:lower:]][[:lower:]][[:upper:]]

which should work for any locale setting

or
Code:
export LC_COLLATE=C
wc -l *.[a-z][a-z][A-Z]

which changes the collation order for your locale to the one use by the C locale.
# 5  
Old 01-01-2015
Quote:
Originally Posted by saravana.sarak
it looks like this on first line ( could not post all the lines here).. and many nfs in the middle of content ...

Code:
Linux Some_server 2.6.18-194.3.1.el5 #1 SMP Sun May 2 04:17:42 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

You also need to provide the output from the "mount" command.

It could just be a case-insensitive file system.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to grep using wildcard in a file.

I wish to check if my file has a line that does not start with '#' and has 1. Listen and 2. 443 echo "Listen 443" > test.out grep 'Listen *443' test.out | grep -v '#' Listen 443 The above worked fine but when the entry changes to the below the grep fails... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Error copying file using wildcard

Hi, cd /web/myf ls -ltr -rwxr-x--- 1 user1 Admin 17 Oct 7 15:53 mykey.db -rwxr-x--- 1 user1 Admin 21 Oct 7 15:53 test.shmore test.sh cd log01 pwd cp ../*.db .When i run the test.sh i get the below output / error. Output: /web/myf/log01 cp: cannot stat `../*.db': No such file... (5 Replies)
Discussion started by: mohtashims
5 Replies

3. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 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

Problem when concatinating wildcard onto file location in bash script

I am having difficulty with the following script: #! /bin/bash filelist=~/data/${1}* ~/./convertFile $filelist ~/temp/outputEssentially, there are a large number of files in the directory ~/data, each with a four-letter code at the beginning (eg. aaaa001 aaaa002 bbbb001 bbbb002 etc). The... (11 Replies)
Discussion started by: Lears_Fool
11 Replies

6. UNIX for Dummies Questions & Answers

Tail command with wildcard file name

Please help with the following command tail -f /appdata/logs/alert_audit517.txt | grep "Sep 02" The problem I have is with the file name "alert_audit517.txt". The 3 digit number at the end of the file name changes, so I need the file name to use a wildcard. Ive tried alert_audit***.txt, but... (5 Replies)
Discussion started by: robertson1995
5 Replies

7. UNIX for Dummies Questions & Answers

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 ls... (2 Replies)
Discussion started by: anandapani
2 Replies

8. Shell Programming and Scripting

sed to delete lines from a file by using wildcard

I have a text file with tons of data and I want to remove all lines which are have "240" regardless of ABC or BCD and shouldnt delete anything else ABC_10_00024045.zip blah blah ABC_10_00024045.zip.new ABC_10_00024046.zip blah blah ABC_10_00024046.zip.new ABC_10_00024446.zip blah blah... (3 Replies)
Discussion started by: gubbu
3 Replies

9. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

10. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies
Login or Register to Ask a Question