10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how can i optimize the following:
TOTALRESULT="total1=4
total2=9
total3=89
TMEMORY=1999"
TOTAL1=$(echo "${TOTALRESULT}" | egrep "total1=" | awk -F"=" '{print $NF}')
TOTAL2=$(echo "${TOTALRESULT}" | egrep "total2=" | awk -F"=" '{print $NF}')
TOTAL3=$(echo... (4 Replies)
Discussion started by: SkySmart
4 Replies
2. Shell Programming and Scripting
Heyas
Me try to print only the value of a (specific) variable assignment from a file.
What i get (1):
:) tui $ bin/tui-conf-get ~/.tui_rc TUI_THEME
dot-blue
""
"$TUI_DIR_INSTALL_ROOT/usr"
"$TUI_DIR_INSTALL_ROOT/etc/tui"
"$TUI_PREFIX/share/doc/tui"
"$TUI_PREFIX/share/tui"... (2 Replies)
Discussion started by: sea
2 Replies
3. Shell Programming and Scripting
Hi,
Was hoping someone could help with the following:
while read line; do pntadm -P $line | awk '{if (( $2 == 00 && $1 != 00 ) || ( $2 == 04 )) print $3,$5}'; done < /tmp/subnet_list
Anyone know if it is possible to assign $3 and $5 to separate variables within the {} brackets?
Thanks... (14 Replies)
Discussion started by: CiCa
14 Replies
4. Shell Programming and Scripting
#ifconfig -a | nawk '/1.1.1.1/{print}'
inet 1.1.1.1 netmask xxxxxxxxx broadcast 0.0.0.0
If i assign the ip to a variable and search for the variable nothing gets printed!!
# ifconfig -a | nawk -v ip=1.1.1.1 '/ip/{print}'
I am not able to understand why this is happening! (6 Replies)
Discussion started by: chidori
6 Replies
5. Shell Programming and Scripting
Hi Guys,
I have an issue with awk and variables. I have trawled the internet and forums but can't seem to get the exactt syntax I need.
I have tried using awk -v and all sorts of variations but I have hit a brick wall. I have spent a full day on this and am just going round in circles.
... (3 Replies)
Discussion started by: gazza-o
3 Replies
6. Shell Programming and Scripting
So, in awk, I've always put my variable assignments inside of the curly braces, just like dad, and grandpa, and the 26 generations before them. But today I came upon an awk statement that had them outside the braces-- blasphemy!
Seriously, though, is there any practical difference? I was... (3 Replies)
Discussion started by: treesloth
3 Replies
7. Shell Programming and Scripting
I am using a piece of code which is working fine in some cases and is not working in some other instances. All I am doing is grep'ing and concatenating.
Below is a working scenario.
$ echo $var1
REPLYFILENAME=Options_NSE1.txt.enc
$ FILE_NM=`echo ${var1##*=}`.gz (Take everything after... (1 Reply)
Discussion started by: jamjam10k
1 Replies
8. Shell Programming and Scripting
Guys,
Could you please help me out. I need two values in two variables using awk from the o/p of grep.
example:-
grep sdosanjh <filename>
sdosanjh myhostname myfilename
NOW WHAT I WANT IS :-
sdosanjh should be in variable (say NAME)
myhostname should be in variable (say... (8 Replies)
Discussion started by: sdosanjh
8 Replies
9. Shell Programming and Scripting
Hi All,
I have a little awk script which uses a variable (x):
awk -v x=0 'NF != 6 { ++x } END { print "This batch had " x " errors out of ", NR" records"}'
But when I've tried to put the command in a file I can't seem to declare the variable. I've managed to simplify the code so that I... (4 Replies)
Discussion started by: pondlife
4 Replies
10. Shell Programming and Scripting
user_account()
{
set -x
nodename=$1
# set userid to user0
userid="user0"
echo outside:pid $$
cat $MY_DIR/user_accounts | while read line
do
# line="node1 user1"
echo inside do: pid $$ line:$line userid:$userid
poss_node=`echo $line |awk '{print $1}'`... (2 Replies)
Discussion started by: jasmeet100
2 Replies