echo: write error: Broken pipe ??


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers echo: write error: Broken pipe ??
# 1  
Old 11-26-2010
echo: write error: Broken pipe ??

I want to try the unix pipe, the command is like this:
echo new | find .

the standard output of the echo should be "new", then I guess find command will use this output as input to find the file named "new". But the output is all the file names in my current dir, the last line is "echo: write error: Broken pipe".

Can anyone kindly tell me why this is happening? Thanks.Smilie
# 2  
Old 11-26-2010
find does not read input from a pipe. That's why you got the error.
Code:
find . -name new

assuming that new is real file name you expect to find. There is no "new" predicate for the find command.

How about this
Code:
ls | grep 'a'

This finds all the files with the letter a in the filename in the current directory.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 11-26-2010
Quote:
Originally Posted by jim mcnamara
find does not read input from a pipe. That's why you got the error.
Code:
find . -name new

assuming that new is real file name you expect to find. There is no "new" predicate for the find command.

How about this
Code:
ls | grep 'a'

This finds all the files with the letter a in the filename in the current directory.
I see. Thanks a lot.
Is there any other command which does not accept input from pipe?
# 4  
Old 11-26-2010
The "df" command is one of many commands which does not accept input from a pipe.
# 5  
Old 11-26-2010
Quote:
Originally Posted by methyl
The "df" command is one of many commands which does not accept input from a pipe.
Many thanks~~
# 6  
Old 11-26-2010
Quote:
Originally Posted by andrewust
I see. Thanks a lot.
Is there any other command which does not accept input from pipe?
echo's another Smilie There's a lot, and a comprehensive list would be difficult and not really all that useful.

Since you've discovered the difference, you may find xargs useful, it's a bridge between arguments and pipes:

Code:
echo new | xargs find

find . | xargs echo

...both pretty useless examples, but you get the idea.
This User Gave Thanks to Corona688 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can we overcome Broken pipe error during scp,SFTP,Rsync while transferring big files.?

Hello All, Hope all are doing well. We use scp (some times sftp and rsync also) for transferring big files (around 2GB each ) from 1 Network to another Network. The Issues which we face :- During transfer some times( Once in 1 week (or twice)) , the speed of transfer gets down to 30 kb/s,... (2 Replies)
Discussion started by: Upendra Bhushan
2 Replies

2. Solaris

RWSocket::send: Broken pipe Error in /var/adm/messages

Hi Guys, I am getting some strange error in /var/adm/messages in my Solaris 10 box with Veritas Cluster and EMC storage. bash-3.00$ cat /var/adm/messages | egrep -v "lw8|snmp|sshd|xntpd|kern.info|LOGIN|link|service|started|finished|repeated|SS7 Log-daemon|success" Dec 18 09:58:35 GAMMa2... (1 Reply)
Discussion started by: vivek.goel.piet
1 Replies

3. UNIX for Dummies Questions & Answers

SFTP error between UNIX to iSeries (Write Failed Broken Pipe)

Hi, I am iseries resource and having Issue in one of the sFTP failures between one of my job (Unix --> iSeries). The response to sending machine (Unix) is "Write Failed Broken Pipe". Appreciate any help Available on why this Issue happens, how can we replicate the same, what fixes can... (1 Reply)
Discussion started by: hamelchauhan
1 Replies

4. Shell Programming and Scripting

How to avoid ssh :Write failed: Broken pipe?

Hello, I am trying to run some code on Matlab over ssh . The code takes around 5-6 hours to complete. so after giving the command to run it , I locked my machine and then went off to sleep at night, only to discover in the morning that I get this message : ...Code running, partial results... (1 Reply)
Discussion started by: ajayram
1 Replies

5. UNIX for Dummies Questions & Answers

broken pipe error

I'm new to scripting, and this forum has been invaluable in helping me out. I'm hoping I can get some personal help now though. I have a korn script that takes a list of servers and either telnets or sshs into it (only some are set up for ssh). What I'm doing now is trying to telnet first, and... (10 Replies)
Discussion started by: aimeet
10 Replies

6. UNIX for Advanced & Expert Users

write failed: Broken pipe

The "write failed: Broken pipe" message is reported by the file sending PC which run my writed network device driver while 500MB or 900MB is sended! What does the message mean? Does this mean there is a bug in my driver? li,kunlun (11 Replies)
Discussion started by: liklstar
11 Replies

7. Shell Programming and Scripting

Broken Pipe error

Hello while doing sftp over server "A" , i am getting a broken pipe error i.e cat: write error: Broken pipe what does that mean? please let me know if you want any other info on this.. (3 Replies)
Discussion started by: urfrnddpk
3 Replies

8. UNIX for Advanced & Expert Users

sftp error:- Couldn't send packet: Broken pipe

Hi, I am trying to sftp a large file(appx. 2 GB size) from solaris 10 to a Linux server. While sftping(with no options), connection is terminated after some time with broken pipe error. sftp with option -R1 or -B1500 is successful. Linux server ssh Version: OpenSSH_3.9p1, OpenSSL 0.9.7a... (3 Replies)
Discussion started by: brij123
3 Replies

9. Programming

Broken Pipe error

All, I am using the below code The C code : if ((fp2=fopen(szout_fname,"r"))==NULL) { sprintf(stream_ptr1,"cat %s | sort -t, -rn -k 11,11 | awk -F\",\" '{ \ if ( \$3 ==\"%s\" ) {print... (0 Replies)
Discussion started by: arunkumar_mca
0 Replies

10. AIX

broken pipe error

Hi, I am working on AIX 5.3 . I have client-server program which is in ProC.while sending packet to server i am getting error as broken pipe and program exiting. please help?/? (1 Reply)
Discussion started by: ajaysahoo
1 Replies
Login or Register to Ask a Question