Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 12-01-2006, 10:11 PM   #1
LQ Newbie
Registered: Nov 2005
Location: Canada
Distribution: CentOS 5.0 & Suse 10.3
Posts: 26

Rep: Reputation: 15
Do you know awk?


I'm trying to assign the line below to a variable, but I can't find the right syntax to do so.

echo $RESULT1 | awk '{print $ARG1"cm is equivalent to "$1 / 2.54"in"}'
Here is the line I tried:
DISPLAY=$(echo $RESULT1 | awk '{print $ARG1"cm is equivalent to "$1 / 2.54"in"}')
But it doesn't work.

Any help is greatly appreciated.
Old 12-01-2006, 10:19 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I can't answer the question, but I may be able to point you in the direction of a solution.

*Effective Awk Programming* is a free (as in, free but for the cost of the internet connection to download it; no other charge) postscript book.

It probably has the answer on how to assign values to variables, specifically the syntax issue.

There is another called *The GNU Awk User's Guide* that might also be helpful.

Last edited by bigrigdriver; 12-01-2006 at 10:21 PM.
Old 12-01-2006, 11:53 PM   #3
LQ Newbie
Registered: Nov 2005
Location: Canada
Distribution: CentOS 5.0 & Suse 10.3
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for the reply. I got it to work.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you know awk? Vitalka Programming 5 12-01-2006 10:42 PM
using awk meniscus Linux - Newbie 6 10-05-2006 12:39 PM
question about awk perfect_circle Programming 4 07-19-2006 02:34 PM
date in awk raj_deep2k1 Linux - Networking 5 01-21-2006 08:09 AM
using awk wedgeworth Linux - Newbie 9 02-20-2004 07:48 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration