Re: [SLUG] Scripting Question

From: Ronan Heffernan (ronan.heffernan@mindspring.com)
Date: Wed Nov 28 2001 - 05:04:42 EST


but it didn't work. I'm trying to avoid awk, sed, perl and such, and
only do this in bash.

Paul-
   I think you are out of luck. I don't think BASH has any
comprehension of "lines".
You could get away with something using sed (one thing that I have done
quite a lot is have one script write another script using sed, awk, etc.
and then execute it).

   A more powerful way is usually to use a "real" scripting language (ie
Python):

#!/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



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