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 regexps as well as grep:

AUXIP=`awk '/localhost/{print $3}' "$INPUTDB/postgresql.conf" | head -n1`

AWK can also exit early:

AUXIP=`awk '/localhost/{print $3;exit}' "$INPUTDB/postgresql.conf"`


> In C++, I use the functions read, write and others for
> manipulation files.

Aren't read and write low level file IO functions?  Why would you use them
instead of cin and cout?


> And Pearl ?

Perhaps you mean Perl?


> After I open the file,

perldoc -f open

> i like to get a simple word

perldoc -f readline
perldoc -f split

> and store in a scalar variable.

perldoc perldata

> Or write after line 10 for example.

perldoc perlvar    (look for the $. variable)

> And others.

perldoc perl




John
-- 
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to