home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
m
/
mawk11as.zip
/
EXAMPLES
/
CT_LENGT.AWK
next >
Wrap
Text File
|
1992-01-21
|
441b
|
29 lines
#!/usr/local/bin/mawk -f
# ct_length.awk
#
# replaces all length
# by length($0)
#
{
while ( i = index($0, "length") )
{
printf "%s" , substr($0,1, i+5) # ...length
$0 = substr($0,i+6)
if ( match($0, /^[ \t]*\(/) )
{
# its OK
printf "%s", substr($0, 1, RLENGTH)
$0 = substr($0, RLENGTH+1)
}
else # length alone
printf "($0)"
}
print
}