Keyboard User Input in awk language ?

Hi,

does someone know how to make a keyboard data input

in the AWK programming language ?

Regards

Zabo

Hello Zabo,

Here is an example for it.

awk 'BEGIN{print "Enter your Name: ";getline name < "-";print RS "Input entered by user is: "name}'

After running the above code following output will be coming.

Enter your Name:
R. Singh
Input entered by user is: R. Singh

Thanks,
R. Singh

1 Like

Thank you , that works. R.Singh

The variable name has the value !

Regards Zabo

...and if standard input is already something else, you can do getline < "/dev/stdin"

1 Like

Thank you.

Erm, I meant, < "/dev/tty" , to force it to read from keyboard even when stdin is a file.