The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
A question/problem about oracle "tns listener" and "enterprise manager" talipk UNIX for Advanced & Expert Users 1 12-03-2008 07:55 AM
A question/problem about oracle "tns listener" and "enterprise manager" talipk UNIX and Linux Applications 0 12-01-2008 03:08 PM
Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" iBot UNIX and Linux RSS News 0 01-04-2008 03:00 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
Unix "at" / "Cron" Command New Problem...Need help Mohanraj UNIX for Dummies Questions & Answers 3 01-26-2006 08:08 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-22-2009
bijeet_sunny bijeet_sunny is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 1
Cool problem using pipes with "ls"

Hi all,

I tried the following command

$ find / -name xyx | ls -l

so logically it should show the listing of directory xyz , assuming there's only one instance of xyz . But the above command shows the listing of current directory instead.

I got the desired result using it in the following maner

$ find / -name xyx | xargs ls -l

so, the confusion is why do I need xargs here
  #2 (permalink)  
Old 09-22-2009
Aleksejs's Avatar
Aleksejs Aleksejs is offline
Registered User
  
 

Join Date: Sep 2009
Location: Riga, Latvia
Posts: 3
Hi!
That is because ls does not operate on standard input - you have to feed it standard input as an argument - that's why you use xargs.
  #3 (permalink)  
Old 10-06-2009
inotech inotech is offline
Registered User
  
 

Join Date: Sep 2009
Location: USSR
Posts: 13
if you want use xargs

Code:
find / -name XYZ -type f | xargs -iINCLUDE ls -l INCLUDE

or


Code:
find / -name XYZ -type f -exec ls -l {} \;

  #4 (permalink)  
Old 10-06-2009
ikorolev ikorolev is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 40

Code:
find . -ls

  #5 (permalink)  
Old 10-12-2009
stevie_velvet stevie_velvet is offline
Registered User
  
 

Join Date: Jan 2008
Location: London e Milano
Posts: 85
1} So Many bways to to the same thing
2) In UNIX very often, the simplest way is already programmed
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0