Unix/Linux Go Back    


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

Keyboard User Input in awk language ?

Programming


Tags
awk, linux, unix

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
Zabo's Unix or Linux Image
Zabo Zabo is offline
Registered User
 
Join Date: Dec 2016
Last Activity: 15 June 2017, 4:56 PM EDT
Location: Germany
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Keyboard User Input in awk language ?

Hi,

does someone know how to make a keyboard data input

in the AWK programming language ?

Regards

Zabo
Sponsored Links
    #2  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
RavinderSingh13's Unix or Linux Image
RavinderSingh13 RavinderSingh13 is online now Forum Advisor  
Registered User
 
Join Date: May 2013
Last Activity: 14 December 2017, 7:49 AM EST
Location: Chennai
Posts: 2,678
Thanks: 590
Thanked 1,275 Times in 1,146 Posts
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)
Sponsored Links
    #3  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 11 December 2017, 5:48 PM EST
Location: Loughborough
Posts: 1,230
Thanks: 371
Thanked 325 Times in 255 Posts
https://www.unix.com/shell-programmin...input-awk.html
    #4  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
Zabo's Unix or Linux Image
Zabo Zabo is offline
Registered User
 
Join Date: Dec 2016
Last Activity: 15 June 2017, 4:56 PM EDT
Location: Germany
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Thank you , that works. R.Singh

The variable name has the value !


Regards Zabo

Last edited by Zabo; 05-17-2017 at 03:57 PM.. Reason: correction
Sponsored Links
    #5  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 13 December 2017, 10:16 AM EST
Location: Saskatchewan
Posts: 22,546
Thanks: 1,159
Thanked 4,286 Times in 3,955 Posts
...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)
Sponsored Links
    #6  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
Zabo's Unix or Linux Image
Zabo Zabo is offline
Registered User
 
Join Date: Dec 2016
Last Activity: 15 June 2017, 4:56 PM EDT
Location: Germany
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Thank you.
Sponsored Links
    #7  
Old Unix and Linux 05-17-2017   -   Original Discussion by Zabo
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 13 December 2017, 10:16 AM EST
Location: Saskatchewan
Posts: 22,546
Thanks: 1,159
Thanked 4,286 Times in 3,955 Posts
Erm, I meant, < "/dev/tty" , to force it to read from keyboard even when stdin is a file.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Read input from Keyboard, do not proceed if no input aravindadla Shell Programming and Scripting 7 02-26-2016 02:24 PM
How to read user keyboard input inside the case? femchi Homework & Coursework Questions 2 11-08-2012 03:13 AM
Testing for correct user input from keyboard Pauline mugisha UNIX for Dummies Questions & Answers 0 11-29-2009 07:16 PM
Keyboard Input cpaquette Programming 4 04-07-2008 02:44 PM
suppressing keyboard input anthreedhr Shell Programming and Scripting 1 10-21-2004 12:05 PM



All times are GMT -4. The time now is 08:58 AM.