10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have below code inside my awk script
if ( $0 ~ /SVC IN:/ )
{
svc_in=substr( $0,23 , 3);
if (msg_start == 1 && msg_end == 0)
{
msg_arr=$0;
}
}
else if ( $0 ~ /^SVC OUT:/ )
{
svc_out=substr( $0, 9, 3);
if (msg_start == 1 && msg_end == 0)
... (6 Replies)
Discussion started by: bhagya123
6 Replies
2. UNIX for Advanced & Expert Users
I have to display only those subscribers which are in "unconnected state" and the date is 90 days older than today's date.
Below command is used for this purpose:
cat vfsubscriber_20170817.csv | sed -e 's/^"//' -e '1d' | \
nawk -F '",' '{if ( (substr($11,2,4) == 2017) && ( substr($11,2,8)... (1 Reply)
Discussion started by: dia
1 Replies
3. Shell Programming and Scripting
I want to create a conditional expression string and pass in an awk script. My script is as below...
comm="\$3 == "hello""
awk -F "^T" -v command="${comm}" ' {
if ( command ) { print "hye" }
}' testBut the statement "if ( command )" always evaluates to true which is not... (5 Replies)
Discussion started by: Saikat123
5 Replies
4. Shell Programming and Scripting
Hi all,
I was doing some string manipulation in my script and wanted to try using awk. However, I have been stuck with string compare. A simplified form of my conundrum is given below:
The below prints expected result (prints "Completed because that is the second element"):
$ echo... (5 Replies)
Discussion started by: faraway
5 Replies
5. Shell Programming and Scripting
Need help for awk..
file will have comma separated numbers, I need check digits before 10 numbers eg ( 001)1234567890
Basically want to check country code of a mobile number.
eg:
abc,def,data, data,0011234567890, data,data
Script should be checking country code with 001, I will pass... (10 Replies)
Discussion started by: vegasluxor
10 Replies
6. Shell Programming and Scripting
I am trying to test two conditions in a single if and getting syntax error on -a and &&
if ] ; then
echo "variable a equals to variable b"
else
echo "variable a not equal to variable b"
fi
in second attempt I used -a instead of &&, referring to other website, but not sure that... (1 Reply)
Discussion started by: praxis1
1 Replies
7. Shell Programming and Scripting
Hi,
I am trying to do evaluate one numerical string after substitution.
++++++++++++++++==
What I have = "7.04+2.3Xlog(0.72e-6X1.0e6)X1.9596"
What I need = evaluate 7.04+2.3*log(0.72e-6*1.0e6)*1.9596 = 5.55941
what I am doing;
echo "7.04+2.3Xlog(0.72e-6X1.0e6)X1.9596" | awk... (2 Replies)
Discussion started by: vivek_shm74
2 Replies
8. Shell Programming and Scripting
Hi,
I have a program written in awk and I want to extend it to do another task.
My program is a list of CVS log reports of a repository. For each file, I have some fields. One of the fields is the comment field. I want to know how I can check if a comment (which is a free text field)... (8 Replies)
Discussion started by: sandeepk1611
8 Replies
9. Shell Programming and Scripting
Hello,
I have this:
#!/usr/bin/ksh
V1=ABC
str="hello 123;${V1}"
eval "echo $str"
i get
hello 123
/script.sh ABC not found
However eval works if $str variable doesn't contain a semicolumn (eg if str="hello 123~${v1}"
running the eval statement above would produce (2 Replies)
Discussion started by: endorphin
2 Replies
10. Shell Programming and Scripting
Hi
How can i compare a string using if statement in a script?
For eg:
I have
filename="abc.sh"
if ;then
{
.......
.......
}
fi
but this doesnot work .. How will i execute this ??
Thanks in advance (1 Reply)
Discussion started by: jisha
1 Replies