Home Man
Search
Today's Posts
Register

Post questions about C, C++, Java, SQL, and other programming languages here.

Keyboard User Input in awk language ?

Tags
awk, linux, programming, unix

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 05-17-2017
Keyboard User Input in awk language ?

Hi,

does someone know how to make a keyboard data input

in the AWK programming language ?

Regards

Zabo
# 2  
Old 05-17-2017
Hello Zabo,

Here is an example for it.
Code:
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.
Code:
Enter your Name:
R. Singh
Input entered by user is: R. Singh

Thanks,
R. Singh
The Following User Says Thank You to RavinderSingh13 For This Useful Post:
Zabo (05-17-2017)
# 3  
Old 05-17-2017
# 4  
Old 05-17-2017
Thank you , that works. R.Singh

The variable name has the value !


Regards Zabo

Last edited by Zabo; 05-17-2017 at 02:57 PM.. Reason: correction
# 5  
Old 05-17-2017
...and if standard input is already something else, you can do getline < "/dev/stdin"
The Following User Says Thank You to Corona688 For This Useful Post:
Zabo (05-17-2017)
# 6  
Old 05-17-2017
Thank you.
# 7  
Old 05-17-2017
Erm, I meant, < "/dev/tty" , to force it to read from keyboard even when stdin is a file.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run command if no mouse or keyboard input drew77 Shell Programming and Scripting 0 4 Weeks Ago 12:17 PM
Read input from Keyboard, do not proceed if no input aravindadla Shell Programming and Scripting 7 02-26-2016 01:24 PM
How to get input from keyboard with watch? bacarrdy Shell Programming and Scripting 0 04-01-2015 08:11 PM
How to read user keyboard input inside the case? femchi Homework & Coursework Questions 2 11-08-2012 02:13 AM
sed execution with input from keyboard loggedin.ksh Shell Programming and Scripting 1 10-09-2012 09:18 AM
Keyboard input question biopulse Shell Programming and Scripting 5 11-29-2010 12:41 AM
Testing for correct user input from keyboard Pauline mugisha UNIX for Dummies Questions & Answers 0 11-29-2009 06:16 PM
Keyboard Input cpaquette Programming 4 04-07-2008 01:44 PM
Don't show keyboard input on terminal marianor31 Shell Programming and Scripting 1 03-23-2007 06:54 PM
suppressing keyboard input anthreedhr Shell Programming and Scripting 1 10-21-2004 11:05 AM


All times are GMT -4. The time now is 10:10 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password