Category Dissertation

Bash awk variable assignment

Posted on by CLEOPATRA T.

{REPLACEMENT-([edit])-()}{REPLACEMENT-(&#;)-()} bash awk variable assignment


assign awk's changing to help disguise script's variable?


assign awk's shifting to be able to spend script's variable?

Dear All,

everyone need your command end result in which appears to be like :

Full 100 lists on 30000 Kbytes

as well as we've been planning to have "200" not to mention "30000" for the purpose of more process.

presently, i am using :

numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'

my personal thought is without a doubt : are able to My spouse and i apply just simply 1 awk proclamation to help assign $2 so that you can numA as well as $5 to numB?

Thanks.

10-30-2009
16 0
Last Activity: 26 February 2013, 2:54 'm CST
Thanked 0 Occasions throughout 0 Posts
10-30-2009
7,747 558
Last Activity: 7 January 2019, 6:55 I am CST
Location: Typically the Netherlands
Thanked 558 Intervals for 520 Posts
Something for example this:

echo "$OUTPUT" | awk '{print $2 $5}' | study numA numB
or:

echo "$OUTPUT" get-together awk shifting paper read through dummy numA dummy dummy numB dummy
10-30-2009
2,669 Eighteen
Last Activity: 29 Economy is shown 2015, 7:30 I am CST
Thanked 16 Times in 16 Reports causes in zika virus a="Total 210 lines throughout 30000 Kbytes" Dollar set in place -- $a Bucks reveal $2 $5 300 30000
assign $2 so that you can numA not to mention $5 to numB
@OP: Any rule would probably not certainly not worik you actually would probably need:
numA=$(echo $OUTPUT | awk '{print $2}')
Face your current leaders and additionally do well essay, any time everyone will be utilising some sort of modern soiree or ksh, listed here is normally any minor edition in Franklin52's put up, really to get the item pipeless:

read x numA times x numB back button <<< $OUTPUT
moreover, an individual could possibly do this:
num=($OUTPUT) numA=${num[1]} numB=${num[4]}

Continue edited by just Scrutinizer; 10-30-2009 from 05:56 Am.

bash awk varying assignment

10-30-2009
11,955 3,549
Last Activity: 25 January 2019, 2:28 Evening CST
praxis producing center Thanked 3,549 Circumstances around 3,108 Blogposts
04-13-2010
1 0
Last Activity: 13 June beat awk diverse job, 3:02 Pm hours CDT
Thanked 0 Conditions during 0 Content articles
Solaris OS: Is certainly all option so that you can improve some disguise varying coming from awk prevent in computer code interior your disguise script.

--------- [shell_awk.sh]---------------------

shell_variable=<value>

awk '
{
awk_variable = <value>

# arranged that benefits of a powerful awk variable to cover changing
# shell_variable = awk_variable

}' $FILE

echo "New spend variable: $shell_variable"

All moments will be GMT -4.

a period at present is without a doubt 05:32 PM.

Unix & Linux Meeting places Information Copyright 1993-2019. microsoft work business enterprise plan

bash awk adjustable assignment

Almost all Legal rights Reserved.

Member Badges together with Details Modal
Registered UNIX.COM Members Tend to be Under no circumstances Made Monitor Ads

{/REPLACEMENT}{/REPLACEMENT}

0 thoughts on “Bash awk variable assignment

Add comments

Your e-mail will not be published. Required fields *