I have created a function in my awk script as follows:
function fun_display() {
for (i=1;i<=PageOne;i++)
if (menupage ~ /^A/)
print substr(menupage,3)
}
I use it to display the line when it starts from "A" letter.
After reading my learning book, it shown that I can insert few variables in ( ) sign. So I tried as follows:
function fun_display(letter) {
for (i=1;i<=PageOne;i++)
if (menupage ~ /^letter/)
print substr(menupage,3)
}
But it didn't work. So how to make my own function? Do anyone can give me an example?
Another question, where can I find awk script example from web? Because I really confused in field one "$1" and the shell parameter "also $1". When I tried to write my awk script, I would not sure my script treats it as field one or shell parameter.
Thanks!
tikual
function fun_display() {
for (i=1;i<=PageOne;i++)
if (menupage ~ /^A/)
print substr(menupage,3)
}
I use it to display the line when it starts from "A" letter.
After reading my learning book, it shown that I can insert few variables in ( ) sign. So I tried as follows:
function fun_display(letter) {
for (i=1;i<=PageOne;i++)
if (menupage ~ /^letter/)
print substr(menupage,3)
}
But it didn't work. So how to make my own function? Do anyone can give me an example?
Another question, where can I find awk script example from web? Because I really confused in field one "$1" and the shell parameter "also $1". When I tried to write my awk script, I would not sure my script treats it as field one or shell parameter.
Thanks!
tikual