listing files along with grep -v


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers listing files along with grep -v
# 1  
Old 05-31-2007
listing files along with grep -v

When I run the command ls | grep -v SNMP It outputs all the files into one column. How can I list them in multiple columns?
# 2  
Old 05-31-2007
Quote:
Originally Posted by charlie11k
When I run the command ls | grep -v SNMP It outputs all the files into one column. How can I list them in multiple columns?
For ksh:

Code:
ls !(*SNMP*)

For bash:

Code:
shopt -s extglob
ls !(*SNMP*)

# 3  
Old 05-31-2007
Sorry, these are directories. When I run the command you suggest, it lists all the directories and their files. Is there a command to list just the directories?
# 4  
Old 05-31-2007
Quote:
Originally Posted by charlie11k
Sorry, these are directories. When I run the command you suggest, it lists all the directories and their files. Is there a command to list just the directories?
Code:
ls -d !(*SNMP*)

# 5  
Old 06-01-2007
what would be the syntax for csh?
# 6  
Old 06-01-2007
Why csh?
Don't know if csh (and variants) supports extended globbing ...

Code:
ls|grep -v 'SNMP'|pr -5 -l10

 
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 all digits behind the comma with grep

Hello, Unix-Forums! 1.23456789 This an example number. It can be any number. I want grep to only find the digits behind the "." That means 23456789 should be the output in this case. How would I do that? (2 Replies)
Discussion started by: intelinside
2 Replies

3. 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

4. Shell Programming and Scripting

grep/matching help with long listing of directories

How do I get this to work? cat somefile | grep "-rw-r--r-- 1 root wheel 287 Sep 10 15:12 shells~" This is the the desired output -rw-r--r-- 1 root wheel 287 Sep 10 15:12 shells~ I basically want an exact match of the line I am grepping for, the special characters and... (5 Replies)
Discussion started by: streetfighter2
5 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. Shell Programming and Scripting

AWK script for directory listing using GREP

Hi, All - script1.awk contains the following script: BEGIN { printf "The following are directory files:" "ls -l | grep '^d' | {print $0}" printf "There were "NR" directories in this list." } When I run the script, Here is what I get: $ awk -f... (4 Replies)
Discussion started by: ora_umair
4 Replies

7. UNIX for Dummies Questions & Answers

Listing files

how would i list all files, directories and exectable files in my directory? is there anyway to find out what date a file was created? Thanks!! (2 Replies)
Discussion started by: trob
2 Replies

8. UNIX for Dummies Questions & Answers

Listing files

Hi there! I would like to list all the files from a directory and its subdirectories. For example: DIRECTORY |- SUBDIR1 ||- sub1.txt ||- sub2.txt |- SUBDIR2 ||- sub3.txt |- root1.txt |- root2.txt I would like to create a fulllist.txt file which contains the list of these files (with... (2 Replies)
Discussion started by: bobix
2 Replies

9. 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

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