LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-03-2006, 03:50 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
how to suppress some of ls's output?


if you do:

ls /usr /opt

it will display the output of each /usr and /opt, but it precedes each with "/usr:" and "/opt:"
Those entries foul up scripts that use something like "foreach f (`ls /usr /opt`)"

Is there a way to suppress the output of "/usr:" and "/opt:"?

Thanks
 
Old 03-03-2006, 04:05 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
I couldn't find anything in the ls man page to do this. Do either of the following help?
Code:
ls /opt /usr | sed -e '/:/d' -e '/^$/d'
find /opt /usr -maxdepth 1 -print
 
Old 03-03-2006, 04:16 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by gilead
I couldn't find anything in the ls man page to do this. Do either of the following help?
Code:
ls /opt /usr | sed -e '/:/d' -e '/^$/d'
find /opt /usr -maxdepth 1 -print
I didn't find anything in the man pages either. The first method is a bit cumbersome, but the latter method works good - I hadn't thought of using find.

still if there's a way to do it with just plain ol' ls, I'd be interested to know.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to suppress output from reiserfs mount jwezel Linux - Software 5 09-27-2005 02:24 AM
How to suppress X Windows display? lnxdmnd Linux - Software 2 04-11-2005 02:44 AM
suppress warning messages h/w Programming 2 10-07-2003 03:56 PM
Suppress Iptables' Output mrsolo Linux - Software 1 05-05-2003 09:45 PM
how to suppress colors frankie_g Linux - Newbie 6 05-15-2002 11:52 AM


All times are GMT -5. The time now is 06:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration