![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| iCal, Mac OS X 10.5: Empty "Home" and "Work" calendars may appear after installing Le | iBot | OS X Support RSS | 0 | 10-13-2008 10:20 PM |
| iCal, Mac OS X 10.5: Empty "Home" and "Work" calendars may appear after installing Le | iBot | OS X Support RSS | 0 | 10-03-2008 04:40 AM |
| acessing awk array element while getline < "file" | timj123 | Shell Programming and Scripting | 9 | 06-27-2008 11:13 PM |
| awk: getline NOM < "-" script does not stop | Klashxx | Shell Programming and Scripting | 2 | 05-17-2006 02:20 AM |
| By angle-brackets/"pipe" button doesn't work? | riwa | Linux | 1 | 04-02-2006 06:43 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
awk's getline < "-" seems not work for pipe
Hi all,
I have an gawk script to get user's input, So I use getline name < "-" (or getline name < "/dev/stdin") in my script They both work fine when my script deals with files. But it is broken for pipes. When I try "some command | my awk script", the variable name just gets an empty value (""), it does not get the value from stdin at all. Why is that ? And how do I fix it ? Last edited by qiulang; 04-08-2009 at 08:01 AM.. |
|
||||
|
It mentions in gawk user's guide The GNU Awk User's Guide
(seach "-"). And it works for files processing. Just seems not work for pipe. |
|
|||||
|
Quote:
if getline < "filename" some command ' file2 now it getline read from filename if getline < "-" some command' file2 now it read from file2 it doesn't mean that it read from stdin |
|
||||
|
Quote:
![]() Actually "sed & awk" had several examples of getline < "-" to read user's input from stdin. I just want to know how to make it work for pipe. |
|
||||
|
Quote:
What you can't do is to get input from a pipe and a file simultaneously. Get the users input in the BEGIN{} part. Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|