It is currently Thu, 20 Jan 2022 04:54:07 GMT



 
Author Message
 read a file line by line
i'm trying to open a file in C shell so that it can be parsed, i've
tried doing this:
$> my.csh filename
foreach line (`cat $1`)
  .....
end
but i get an error, this is the only way i could think of going through
the file line by line. any suggestions?
s


 Fri, 27 Dec 2002 03:00:00 GMT   
 read a file line by line

Do you self a favour and read
http://www.perl.com/pub/language/versus/csh.html

then use sh/ksh/bash/zsh like

while read line
do
  ..
done <filename



 Fri, 27 Dec 2002 03:00:00 GMT   
 read a file line by line

There is actually a very simple answer to this. Stop using csh and start
using ksh. Once you do that you will find that not only can you do a lot
of things with ksh that csh can't handle, but you'll also be working
with a shell that was developed by a real professional rather then a
bunch of college computer-science-weinies.



 Fri, 27 Dec 2002 03:00:00 GMT   
 read a file line by line
On 2000-07-10 mchal...@cs.newpaltz.edu said:
   >i'm trying to open a file in C shell so that it can be parsed, i've
   >tried doing this:
   >$> my.csh filename
   >foreach line (`cat $1`)
   >.....
   >end
   >but i get an error, this is the only way i could think of going
   >through the file line by line. any suggestions?
   >s
What exactly do you want to do with the file?  You might be better off using
sed or awk..
Net-Tamer V 1.08X - Test Drive


 Fri, 27 Dec 2002 03:00:00 GMT   
 
   [ 4 post ] 

Similar Threads

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

2. line by line reading of the lines in list

3. Reading a script file line by line.

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

5. reading files line-be-line?

6. read a file line by line in csh script

7. Read a file line after line

8. reading line by line from a file

9. reading a file line by line

10. ksh script --reading file line by line?


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