Re: [SLUG] Scripting Question

From: Aharon (aharon@superfreeway.com)
Date: Tue Nov 27 2001 - 20:58:09 EST


On Wed, 28 Nov 2001, Ronan Heffernan wrote:

>
> #!/usr/local/bin/python
> fileobj=open("myfile")
> lines=fileobj.readlines()
> for i in lines:
> print i
> # or do something other than "print" the contents of the string variable i
>
> --ronan

I wish I understood OO programming better :( That looks like gibberish to
me.

I know you wanted to avoid perl, and python.. But, it's so easy to do in
both.

#!/usr/bin/perl

open (file,"/path/file.name");
while (<file>) {
        print "Do something with this line $_\n";
        # $_ is the var for the current line
}
close(file);

-- 
Sr Unix Administrator
Tampa, Florida

Websites: http://www.tamparacing.com http://www.tampaforums.com http://www.ls6.com http://www.lastgen.com http://www.xmbforum.com



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:53:58 EDT