gawk һЩs֪R
gnu awk (gawk) һh׃, AWKPATHÁoÑԶ·ָAO
/usr/lib/awk
Ñ ~/.bash_profile Լ, ǾͿ{
ҵ
[code]
fang@bash ~
$ tail -n1 < .bash_profile
export AWKPATH="/usr/lib/awk:/usr/share/awk:$HOME/lib/awk"
[/code]
{
[code]
fang@bash ~
$ ls /usr/share/awk
assert.awk ctime.awk gettime.awk libintl.awk ord.awk rewind.awk zerofile.awk
bits2str.awk ftrans.awk group.awk nextfile.awk passwd.awk round.awk
cliff_rand.awk getopt.awk join.awk noassign.awk readable.awk strtonum.awk
fang@bash ~
$ gawk -f round.awk --source 'BEGIN{print round(3.6)}'
4
fang@bash ~
$ gawk -f round.awk --source 'BEGIN{print round(3.23)}'
3
[/code]
script {ÄtҪһ gawk maintainer , Arnold Robbins shell script, igawk
[code]
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to
gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may
have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or
one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk
supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
fang@bash ~
$ cat round_num
#! /bin/igawk -f
@include round.awk
{
for (i=1; i<=NF; i++){
print round($i)
}
}
fang@bash ~
$ echo 12.35 4.6 23.12 | ./round_num
12
5
23
[/code] עһ ...
ҳ:
[1]