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
Hello All,
I have a file like this:
bash-3.00$ cat 1.txt
201112091147|0|1359331220|1025
201112091147|0|1359331088|1024
201112091144|0|1359331172|1025
201112091147|0|1359331220|1021
201112091149|0|1359331088|1027
201112091144|0|1359331172|1029
and a list of MSISDNs in another file... (9 Replies)
Discussion started by: EAGL€
9 Replies
4. 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
5. 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
6. 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
7. Shell Programming and Scripting
Hi Guys,
i have this files:
xyz20080716.log
opqrs20080716.log
abcdef20080716.log
xyz20080717.log
oprs20080717.log
abcde20080717.log
currentdate: 20080717.log
I want to make script to zip the file for past day. Can anyone help for this? i've just learn awk scripting & still confused with... (3 Replies)
Discussion started by: icy_blu_blu
3 Replies
8. Shell Programming and Scripting
Hello guys,
I want to make a conditional cause in the following file using awk:
awk '{ if ($2 != 0) print $1, $2, $3}' test.csv > test2.csv
FILE EXAMPLE = test.csv
string,number,date
abc,0,20050101
def,1,20060101
ghi,2,20040101
jkl,12,20090101
mno,123,20020101 ... (2 Replies)
Discussion started by: Rafael.Buria
2 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
I am facing a strange situation with awk.
If I do variable substitution for substr it gives value starting from 9th char to
the end of record. Following is the command.
awk -v offset=9 -v length=4 '{ print substr($0,offset,length) }' filename
But for the same if I ommit assignment & harcode... (2 Replies)
Discussion started by: videsh77
2 Replies