>> @tmp = map { (split)[2] } grep { /localhost/ } ;
>
>This is a bad idea if the file you are reading from is at all large.
Yes memory consuming of using map and grep is the fact.
But AFAIK postgresql.conf is not big at all (just a few lines) b/c I'm pretty
familiar with it. :)
--
To unsubscr
On 3/16/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
snip
@tmp = map { (split)[2] } grep { /localhost/ } ;
snip
This is a bad idea if the file you are reading from is at all large.
It is better to use a real loop rather than map or grep when reading
from a file. The problem lies in the fact that
>In shell-script I get a variable with command line:
>
>AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
> | awk '{print $3}' | head -n1`
>
Hello,
In Perl it can most likely be written as:
open FILE,"$INPUTDB/postgresql.conf" or die $!;
@tmp = map { (split)[2] } grep { /localhost/ } ;
c
Rodrigo Faria Tavares wrote:
> Hello,
Hello,
> In shell-script I get a variable with command line:
>
> AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
> | awk '{print $3}' | head -n1`
UUOC:
AUXIP=`grep "localhost" "$INPUTDB/postgresql.conf" | awk '{print $3}' | head
-n1`
AWK can do re
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And Pearl ?
After I open the file, i like to get a simple word and
store
On 3/16/07, Rodrigo Faria Tavares <[EMAIL PROTECTED]> wrote:
snip
After I open the file, i like to get a simple word and
store in a scalar variable. Or write after line 10 for
example. And others.
snip
In Perl file operations are generally handled by file handles. If you
want to use the object
Hi Rodrigo,
On 2007/03/16, at 18:09, Rodrigo Faria Tavares wrote:
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And P
Hello,
In shell-script I get a variable with command line:
AUXIP=`cat $INPUTDB/postgresql.conf | grep "localhost"
| awk '{print $3}' | head -n1`
In C++, I use the functions read, write and others for
manipulation files.
And Pearl ?
After I open the file, i like to get a simple word and
store