BEGIN {
ARGC = 2; ARGV[1] = "-"
do {
printf("prompt>")
while ((input = getline) > 0)
if ($0 ~ "exit") {
print "Exit!"
input = 0;
break
} else if(NF > 1)
{
a[$1] = $2;
b[$2] = $1;
break
} else if(NF == 1)
{
printf $1 " ";
print a[$1] b[$1];
break
}
} while (input > 0)
}
D:\Awk>awk talk
prompt>He Helium
prompt>Ne Neon
prompt>He
He Helium
prompt>Neon
Neon Ne
prompt>exit
Exit!
No comments:
Post a Comment