The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
redirect the grep output into the variable mail2sant Shell Programming and Scripting 1 04-08-2008 10:46 AM
Assigning output of command to a variable in shell sankar reddy Shell Programming and Scripting 6 02-28-2008 03:01 AM
assigning nawk output to shell variable user_prady Shell Programming and Scripting 6 11-29-2007 04:01 AM
Redirect Output In Variable ZINGARO UNIX for Dummies Questions & Answers 1 08-02-2006 07:56 AM
redirect command output to variable hugow UNIX for Dummies Questions & Answers 1 06-22-2005 07:43 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-09-2006
dhinge's Avatar
dhinge dhinge is offline
Registered User
  
 

Join Date: Nov 2006
Location: Salt Lake City, UT
Posts: 24
awk redirect output to shell variable

I'm trying to redirect awk's output to a BASH variable. Currently the statement looks like this

options=`awk '{ while (i < NF) { print $i; ++i } }' answer

but for some reason that makes $options look like this:

1 2 3 4
1
2
3

Now, the input file 'answer' is taken from a dialog checklist. So if I choose option 1, 2, 3, and 4, they are printed to $options twice, but in horizontal, then vertical order. And 4 is gone! Try to explain that.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0