[Linux-Biella] Sed
Andrea Ferraris
linux@ml.bilug.linux.it
Fri, 6 Feb 2004 14:18:15 +0100
> From: "Cristiano Deana" <deana@bmm.it>
[...]
> Il giorno Friday 06 February 2004 11:02, Andrea Ferraris mi scriveva:
>
> > > Ci sono mille cose che awk e sed ti permettono di fare piu'
velocemente
> > > di perl ma ce ne sono 10000 che puoi fare con perl e NON con awk e
sed.
>
> > Non parlo di sviluppo di programmi, ma nel campo dell'amministrazione
> > di un sistema UNIX?
>
> Con quanti db puoi interfacciarti con sed/awk?
Questa proprio non e` amministrazione di un sistema UNIX,
ma programmazione di un db per cui forse - p.es. nel caso
di Oracle - piuttosto di perl e` meglio pl-sql.
Per quanto riguardava mysql, ti assicuro che per molte
cose potevi usavo la shell senza problemi.
Comunque rimane il punto che interfacciarti con un db non
rientra nell'amministrazione di un sistema UNIX, ma nella
programmazione del db, per cui effettivamente puo`
essere meglio perl.
> Quanti socket puoi aprire con sed/awk?
Beccati questa ;-) dal manuale di gawk:
Using gawk for Network Programming
EMISTERED: A host is a host from coast to coast,
and no-one can talk to host that's close,
unless the host that isn't close
is busy hung or dead.
In addition to being able to open a two-way pipeline to a coprocess on the
same system (see Two-Way Communications with Another Process), it is
possible to make a two-way connection to another process on another system
across an IP networking connection.
You can think of this as just a very long two-way pipeline to a coprocess.
The way gawk decides that you want to use TCP/IP networking is by
recognizing special file names that begin with /inet/.
The full syntax of the special file name is
/inet/protocol/local-port/remote-host/remote-port. The components are:
protocol
The protocol to use over IP. This must be either tcp, udp, or raw, for a
TCP, UDP, or raw IP connection, respectively. The use of TCP is recommended
for most applications.
Caution: The use of raw sockets is not currently supported in version 3.1 of
gawk.
local-port
The local TCP or UDP port number to use. Use a port number of 0 when you
want the system to pick a port. This is what you should do when writing a
TCP or UDP client. You may also use a well-known service name, such as smtp
or http, in which case gawk attempts to determine the predefined port number
using the C getservbyname function.
remote-host
The IP address or fully-qualified domain name of the Internet host to which
you want to connect.
remote-port
The TCP or UDP port number to use on the given remote-host. Again, use 0 if
you don't care, or else a well-known service name.
Consider the following very simple example:
BEGIN {
Service = "/inet/tcp/0/localhost/daytime"
Service |& getline
print $0
close(Service)
}
This program reads the current date and time from the local system's TCP
daytime server. It then prints the results and closes the connection.
Because this topic is extensive, the use of gawk for TCP/IP programming is
documented separately. See TCP/IP Internetworking with gawk, which comes as
part of the gawk distribution, for a much more complete introduction and
discussion, as well as extensive examples.
> ecc. ecc.
> Perl e' completo.
>
> > per le attivita` piu` comuni di amministrazione di un sistema UNIX e`
> > piu` adatto (efficace ed efficiente) perl o la shell con le utility
messe
> > a disposizione dal sistema?
>
> A volte le seconde non bastano.
Si`, quando non si tratta di amministrazione del sistema UNIX.
Andrea