Listing required files

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Listing required files
# 1  
Old 10-12-2015
Listing required files

Code:
-rwxrwxrwx 1 eurv1adm eurv1 62 Oct  7 07:42 sample.sh
-rwxrwxrwx 1 eurv1adm eurv1  1 Oct 12 08:47 new.sh
-rwxrwxrwx 1 eurv1adm eurv1  0 Oct 12 08:48 MIS322RRF.txt
-rw-r--r-- 1 eurv1adm eurv1  0 Oct 12 09:05 MES8837TETE.txt

I have these files

I want to display files which does not start with "MIS"

Code:
-rwxrwxrwx 1 eurv1adm eurv1 62 Oct  7 07:42 sample.sh
-rwxrwxrwx 1 eurv1adm eurv1  1 Oct 12 08:47 new.sh
-rw-r--r-- 1 eurv1adm eurv1  0 Oct 12 09:05 MES8837TETE.txt

What is the command to get the result as required?

Last edited by Don Cragun; 10-12-2015 at 05:08 AM.. Reason: Add CODE tags.
# 2  
Old 10-12-2015
That depends on the system and shell you use. With a recent bash,
Code:
shopt -s extglob
ls -la !(MIS*)

might work.
This User Gave Thanks to RudiC For This Post:
# 3  
Old 10-12-2015
Just using standard shell features, you can get what you want with:
Code:
ls -l [^M][^I][^S]* M[^I][^S]* [^M]I{^S]* [^M][^I]S* MI[^S]* M[^I]S* [^M]IS* 2>/dev/null

With some shells with some non-standard options and/or environment variables, there are easier ways to do this. For example, with a recent bash shell, you could use:
Code:
GLOBIGNORE="MIS*"
ls -l *

And, with a 1993 version of the ksh shell, you could use:
Code:
ls -l !(MIS*)

or with a recent bash shell:
Code:
shopt -s extglob
ls -l !(MIS*)

This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Listing the file name and no of records in each files for the files created on a specific day

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

2. Shell Programming and Scripting

Listing files

Hi i want to list files for particular date in AIX. when give ls -ltr it shows following result lrwxrwxrwx 1 applnvd dba 48 Jan 25 17:06 XXSYKPERINTEMAIL -> /nvdev/apps/apps_st/appl/fnd/12.0.0/bin/fndcpesr so i want to display result only for JAN25 Kindly suggest. (2 Replies)
Discussion started by: ankit2012
2 Replies

3. SuSE

Listing files

Hi, This may be silly for some of you guys, but please guide me, I have the followin fies in my directory, root@unix:/onlineredo/XTT77 : ls -l total 4129992 -rw------- 1 XTT77 XTT77 10493952 Jul 28 2010 S0106839.LOG -rw------- 1 XTT77 XTT77 10493952 Jul 28 2010 S0106840.LOG... (3 Replies)
Discussion started by: suren1829
3 Replies

4. UNIX for Dummies Questions & Answers

Need help with listing files

Hi, I came up with this question in one of the exercises . Use find to produce a long ls listing of all files in /usr/bin that are more than 750Kb long. You’ll need to use a form like find ..... -exec ls -l {} \; The semicolon must be escaped, but not the . I tried using below code ,... (1 Reply)
Discussion started by: krthknaidu
1 Replies

5. Shell Programming and Scripting

perl script for listing files and mailing the all files

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

6. UNIX for Dummies Questions & Answers

listing certain files

How would i list the files that begin with a and end with .erc with 4 characters between (5 Replies)
Discussion started by: trob
5 Replies

7. UNIX for Dummies Questions & Answers

listing files

how would i list all files that began witha "t" and have any number of characters after the "t"? (2 Replies)
Discussion started by: trob
2 Replies

8. UNIX for Advanced & Expert Users

listing files excluding files from control file

I have a directory named Project.I have a control file which contains valid list of files.I would like list the files from directory Project which contains files other than listed in the control file. Sample control file: TEST SEND SFFFILE CONTL The directory contains followign... (15 Replies)
Discussion started by: ukatru
15 Replies

9. Linux

Listing of files

How can I list all files in a directory and its subdirectories that have been created or changed since the system was booted. I was trying to acomplish this with "ls" and "find" commands but could not get anything usefull. Maybe some one can provide me a hint. Thank you for your time. (1 Reply)
Discussion started by: Vitalka
1 Replies

10. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

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
Login or Register to Ask a Question