It is currently Tue, 07 Dec 2021 02:17:52 GMT



 
Author Message
 read pipe line by line
Hello guys,

I got a question here: I use cat to print a file to a pipe,
then read a line to an array, but it doesnt work. What shall
I do? Here is the code:

i=0
while cat testfile | read lines
do
x[i]=$lines
((i+=1))
done

the testfile is like this:
abc
def
ghi
...

Thanks in advance
Baihao

--
Posted via Mailgate.ORG Server - http://www.**-**.com/



 Sat, 29 Oct 2005 09:20:56 GMT   
 read pipe line by line

i=0
cat testfile | while read lines
 do
 x[i]=$lines
 ((i+=1))
done

--
http://ftp.opensysmon.com is a shell script archive site with an
open source system monitoring and network monitoring software package.
Many platforms are supplied already compiled.



 Sat, 29 Oct 2005 14:11:24 GMT   
 
   [ 2 post ] 

Similar Threads

1. line by line reading of the lines in list

2. read from stdin while reading line by line a file

3. rsh command piped to while read line

4. rsh command piped to while read line

5. Reading a script file line by line.

6. How to read line by line in csh

7. Read line at at time and split up that line

8. Using read within a loop that parses a file line by line

9. reading files line-be-line?

10. read a file line by line in csh script


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software