pipe | question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pipe | question
# 8  
Old 06-08-2007
An example :
Code:
cat patterns_file | xargs -i{} awk -v value="{}" '$0 ~ value' infile

Jean-Pierre.
# 9  
Old 06-08-2007
thank u guys.. trying to make it work.. i have some gud ideas now
# 10  
Old 06-08-2007
also, u coudln't do this.. if u wanted to use that as multiple argument.. rite?

awk '{print $3}' filename | xargs -i{} for host in {} do ; for i in 1 2 do ; do scp $i@{}

will above work?
# 11  
Old 06-08-2007
echo testrich testrich2 | for i in $* ; do echo $i ; done # this does not work
# 12  
Old 06-09-2007
Quote:
Originally Posted by hankooknara
also, u coudln't do this.. if u wanted to use that as multiple argument.. rite?

awk '{print $3}' filename | xargs -i{} for host in {} do ; for i in 1 2 do ; do scp $i@{}

will above work?
doesn't work.
Code:
awk '{print $3}' filename | 
while read h
do
   for i in 1 2
   do
      scp $i$h
   done 
done

or if you really want to use xargs (and for loop):
Code:
awk '{ for (i=1; i<=2; i++) print i "@" $3}' filename | xargs scp

Jean-Pierre.
# 13  
Old 06-09-2007
jean-peire, thanks, this works like a charm

file * | grep perl | awk -F':' '{print $1}' | while read yahoo ; do mv $yahoo /script/data ; done
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

2. UNIX for Dummies Questions & Answers

xargs vs. pipe

I have been using unix on and off for a number of years. I am not a sys admin. I use what I need. I have googled this, but I really can't figure out what is the difference between using xarg and just using a regular pipe? Why do I need to include xarg sometimes and how do I know when I need it? (2 Replies)
Discussion started by: guessingo
2 Replies

3. Programming

Newbie question on exec,fork, wait,pipe C

Hello everybody.I want to make clear that i am not going to ask from anybody to build my asignement but i have a big problem. I can't seem to find anywhere ONE good example on C about what i am trying to do:wall:.I think it is simple. All i ask is one example, even a link is fine. So, i want to... (1 Reply)
Discussion started by: Cuervo
1 Replies

4. Shell Programming and Scripting

Replace pipe with Broken Pipe

Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix (1 Reply)
Discussion started by: saj
1 Replies

5. Shell Programming and Scripting

How can I use pipe

Hi, guys: I am working on my shell using c. How can I use pipe to implement the following? ls -l 1>> | grep hellp 1<< 2>> | less 2<< (the output of ls goes to grep, and the output of grep goes to less) Thanks Please use and tags when posting code, data or logs etc. to preserve... (1 Reply)
Discussion started by: tomlee
1 Replies

6. UNIX for Dummies Questions & Answers

BASH Pipe question

Hi all, I'm new to shell scripting, but enjoying myself! :cool: I'm trying to execute the following statement: alias evol="ps -AH | grep evol | cut -d' ' -f2 | kill -9" As you might guess. I'm wanting to use a single command 'evol' to kill all the processes containing the phrase 'evol' ... (4 Replies)
Discussion started by: mgrahamnz
4 Replies

7. Shell Programming and Scripting

Pipe filtering

Hi, The thing is that sometimes I need to filter an arbitrary output given a condition (think on the "filter" function present on some programming languages) from the shell (I use sh/bash). I tried this: #!/bin/sh # Usage: filter command COMMAND=$1 shift 1 xargs "$@" -I "{}" sh -c "if... (3 Replies)
Discussion started by: tokland
3 Replies

8. UNIX for Dummies Questions & Answers

Named PIPE

Gurus, I've a File Transaction Server, which communicates with other servers and performs some processing.It uses many Named PIPE's. By mistake i copied a named PIPE into a text file. I heard that PIPE files shouldn't be copied.Isn't it? Since it's a production box, i'm afraid on... (2 Replies)
Discussion started by: Tamil
2 Replies

9. UNIX for Dummies Questions & Answers

Question in reference to the pipe |

My question is can you use the pipe more than one time in the same command line? By the way I am new to UNIX. Thanks in advanced! (3 Replies)
Discussion started by: elkoreanopr
3 Replies

10. Programming

pipe help

i made a lot of processes. here is the code: main() { printf("\nEnter K="); scanf("%d",&k); printf("Enter L="); scanf("%d",&l); printf("\nFather id=%d\n",getpid()); x=0; makechild(); sleep(2); return 1; } int makechild() { for(q=1;q<=k;q++) { if(f=fork()) { ... (5 Replies)
Discussion started by: bb666
5 Replies
Login or Register to Ask a Question