broken pipe?


 
Thread Tools Search this Thread
# 1  
broken pipe?

Hi there,

I try to use:
> find * | ls
but it just gave me one level of ' ls '. and it said:

> find * | ls
dir1 dir2 f1 f2 f3
Broken Pipe
>

what is broken pipe?
how can i fix it?

thks

Gusla
# 2  
Use a big wrench! Smilie

Seriously, though, you shouldn't have to pipe find to ls.
Also, you should use "find .", since it will begin in ".", the current directory.

Check the man page for find. If you wanted a long listing, for example, you could use either of these commands:

find . -exec ls -l {} \;
find . | xargs ls -l

You can also narrow it down to type files, or just directories:
find . -type f -exec ls -l {} \;
find . -type d -exec ls -l {} \;

Hope this helps.
# 3  
Question i wanted to pipe to perl!

thks Freelive.

my initial purpose is wanted to pipe the files to a perl program.

see, say my perl program is getfile.pl (taking file names as argumemnts)
Code:
# getfile.pl
#!/usr/bin/perl -w
 while ($ARGV = shift)
 {
        print "\nprocessing $ARGV...";
        if (-d $ARGV)
        {
           print "\n$ARGV is a DIR\n";
         }
 }

if i use:
> getfile.pl f1 f2 dir1 dir2
to execute the perl file, it's working.

However, if i use:
> ls | getfile.pl OR >find * | getfile.pl
it's not working. It wouldn't recoglise the input argument (@ARGV is empty)

also
>getfile.pl < f1 f2 dir1 dir2

it only recognise f2, dir1, dir2. The first argument f1 is missing. (ie. @ARGV only contains f2, dir1 and dir2)


WHY?

appreciate as usual

Gusla
Smilie

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 11:41 AM..
# 4  
Sorry, I'm not a perl kinda guy...

Hopefully someone else can help here...
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Broken pipe
gartie
Hi all, I am trying to run a sleep command and I am receiving a broken pipe when I execute. any help would be greatly appreciated. sleep `< /dev/urandom tr -dc 0-6 | head -c2`... Red Hat
2
Red Hat
Replace pipe with Broken Pipe
saj
Hi All , Is there any way to replace the pipe ( | ) with the broken pipe (0xA6) in unix... Shell Programming and Scripting
1
Shell Programming and Scripting
pipe broken
abir2
hi i have a server, and i have a web site and i installed apache in the /usr/local/apache/logs i have a file and i have this problem (32)Broken pipe: core_output_filter: writing data to the network plz help me how i can resolve this plz it's urgent th... UNIX and Linux Applications
1
UNIX and Linux Applications
Broken Pipe
ramkrix
Hi I tried to open the man page of sh and piped to `pg`. Normally while reading a file page by page using `pg`, if we wanna quit at the middle of file, we give "q" near the colon mode. Ex1: $cat file1 | pg hi how r u : (page1) now press "return key", it will go to next page yes i ...... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers
broken pipe
eloquent99
sometimes I ftp files from an Unix environment from the command prompt of my win2000 pc and I get a "broken pipe" message. sometimes I'll get nothing but sometimes I'll get part of the file. Whats this "broken pipe" about??... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers