display types of files using metacharacters


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers display types of files using metacharacters
# 1  
Old 01-18-2011
display types of files using metacharacters

1) I want to display all the files in a directory that start with the word chapter, are followed by a digit 1,2,6,8, or 9 and end with .eps or .prn
so I came up with this
Code:
file ~/temp/chapter[1,2,6,8,9].eps ~/temp/chapter[1,2,6,8,9].prn

but is there a better way, i.e. combining both file types into the command?

2)I want to display all the types of files in home dir whose name do not start with a,k,G,Q in which the third letter in the name is not a digit and not a letter(upper or lowercase)
Code:
file ~[b-j,l-z,A-F,H-P,R-Z]

(<-- there must be a better way)(I have no idea how to check that the third char is not a digit or letter)?

I have gone over the chapter 3 times and can't find a solution.
btw, this is not a h/w assignment, just self study.

thanks for any help

Last edited by vbe; 01-18-2011 at 05:18 AM.. Reason: Use code tags please
# 2  
Old 01-18-2011
Chapter 3 of which book?
# 3  
Old 01-18-2011
LINUX & UNIX Programming Tools: A Primer for Software Developers :Sarwar

Also it's Chapter 2, that I have gone over 3 times.

One more thing, should I have posted this in the shell / bash forums? or is here ok?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Recursive grep with only certain types of files

Can I please have some ideas on how to do a recursive grep with certain types of files? The file types I want to use are *.c and *.java. I know this normally works with all files. grep -riI 'scanner' /home/bob/ 2>/dev/null Just not sure how to get it to work *.c and *.java files. (5 Replies)
Discussion started by: cokedude
5 Replies

2. Shell Programming and Scripting

How to skip copying some types of files in csh

Hi, I want to copy data from one directory to another in csh script. But in that i want to skip certain types of file. How can i do that. Currently i am copying all the files as mentioned below.. foreach d ( $TEST_PATH/*) cp -R $d $PWD end now i want to skip files... (3 Replies)
Discussion started by: vdhingra123
3 Replies

3. Shell Programming and Scripting

loop to display whatever number use types

sorry couldnt think of a proper title lol ok i have the following script it asks the user how many html tags they want. Im not sure how to display 2 tags if the user eneters the want only 2 tags tags as in <p></p> or <h1></h1> read -p "How many tags" tags1 if then echo "<$tags1>... (3 Replies)
Discussion started by: gangsta
3 Replies

4. Shell Programming and Scripting

Remove two types of files from a directory

Hi All, i need to move two types of files from a directory. I have used the below command to find the files from the directory.. SOURCE_DIR="some directory path" TARGET_DIR="Target Dir" Datestamp=Date_format find $SOURCE_DIR \( -name "*.log" -o -name "*.out" ) - exec ls -1 {} \; now i... (9 Replies)
Discussion started by: ch33ry
9 Replies

5. Ubuntu

display the mounted file system types

how can i list/display the mounted partitions in Ubunutu, mount command just display the devices but not the file system used. (4 Replies)
Discussion started by: XP_2600
4 Replies

6. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

7. Shell Programming and Scripting

list quantity of files by file types

I'm trying to create a simple file inventory for a series of huge directories containing e-records. What I'm after is a list of all directories and sub-directories with just the number of each type of file in that directory/sub-directory. For example output would look like: ... (6 Replies)
Discussion started by: dorcas
6 Replies

8. Shell Programming and Scripting

Find duplicates from multuple files with 2 diff types of files

I need to compare 2 diff type of files and find out the duplicate after comparing each types of files: Type 1 file name is like: file1.abc (the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations). The other file is file1.bcd01abc (the extension... (2 Replies)
Discussion started by: ricky007
2 Replies

9. UNIX for Advanced & Expert Users

selection of files based on its types

Daily we are getting some datafiles to our unix server location FTPIN. Incoming File names will be present in the location "/xyz/test/" as below: "infile_A1_YYYYMMDD", "infile_A2_YYYYMMDD", "infile_B1_YYYYMMDD", "infile_C1_YYYYMMDD" "infile_C2_YYYYMMDD" Where A, B and C are the... (3 Replies)
Discussion started by: ganapati
3 Replies

10. UNIX for Dummies Questions & Answers

find directory with 2 types of files

Trying to use the find command to find any directory which contains a file ending in .zip AND a file ending in .o I'm having trouble specifying multiple files as criteria and have can't seem to figure it out from Unix in a Nutshell and Google. (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question