Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

Linux bash syntax Q:

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2005, 06:56 AM
Default Linux bash syntax Q:



Im posting here cuz I know you guys know!
Is there a simple way to route standard out to the parameter of a second
command...
like say you want to find a file and then less it.
something like: locate peanut.txt | less <stdin>

thanks guys!




Coenraad Loubser
Reply With Quote
  #2  
Old 01-13-2005, 08:14 AM
Bill Marcum
Guest
 
Posts: n/a
Default Re: Linux bash syntax Q:

On Thu, 13 Jan 2005 08:56:24 +0200, Coenraad Loubser
<(E-Mail Removed)> wrote:
> Im posting here cuz I know you guys know!
> Is there a simple way to route standard out to the parameter of a second
> command...
> like say you want to find a file and then less it.
> something like: locate peanut.txt | less <stdin>
>

locate peanut.txt | xargs less


--
BOFH excuse #270:

Someone has messed up the kernel pointers
Reply With Quote
  #3  
Old 01-13-2005, 08:43 AM
Coenraad Loubser
Guest
 
Posts: n/a
Default Thanks!




Reply With Quote
  #4  
Old 01-14-2005, 01:02 AM
Moe Trin
Guest
 
Posts: n/a
Default Re: Linux bash syntax Q:

In article <cs55vr$anl$(E-Mail Removed)>, Coenraad Loubser wrote:

>Im posting here cuz I know you guys know!
>Is there a simple way to route standard out to the parameter of a second
>command...


http://tldp.org/guides.html

Dec 6 13:54 Bash-Beginners-Guide
Nov 15 08:41 abs-guide

>like say you want to find a file and then less it.
>something like: locate peanut.txt | less <stdin>


backquotes - the ones to the left of the '1' key on most keyboards.

less `locate peanut.txt`

That says take the output of the locate command and feed that to 'less'
as an argument. This is different from 'locate peanut.txt | less' which
would display the text that locate found (filenames).

Old guy

Reply With Quote
  #5  
Old 01-16-2005, 06:31 PM
Jose Maria Lopez Hernandez
Guest
 
Posts: n/a
Default Re: Linux bash syntax Q:

Coenraad Loubser wrote:
> Im posting here cuz I know you guys know!
> Is there a simple way to route standard out to the parameter of a second
> command...
> like say you want to find a file and then less it.
> something like: locate peanut.txt | less <stdin>
>
> thanks guys!


Try:
find <whatever> -exec less {} \;


--

Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
(E-Mail Removed)
bgSEC Seguridad y Consultoria de Sistemas Informaticos
http://www.bgsec.com
ESPAÑA

The only people for me are the mad ones -- the ones who are mad to live,
mad to talk, mad to be saved, desirous of everything at the same time,
the ones who never yawn or say a commonplace thing, but burn, burn, burn
like fabulous yellow Roman candles.
-- Jack Kerouac, "On the Road"
Reply With Quote
Reply

Tags
bash, linux, syntax

Thread Tools
Display Modes

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
Forum Jump


All times are GMT. The time now is 01:31 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.