One way would be to avoid decimal numbers. For me, this works
A different approach would be to avoid equal compares with decimal numbers. Instead you could write
But since awk does not have a builtin abs function, you would have to provide one in your awk-script:
Hello:
I have the following perl script which is giving me trouble inside the second elsif statement. The purpose of the script is to go through a file and print out only those lines which contain pertinent information. The tricky part came when I realized that certain items actually spanned... (5 Replies)
Hi,
I have a variable, $sername, and I would like to display this variable only if it *does not* contain either of these two tags: *DTI*FA* or *DIFF*FA*.
I think the syntax for my 'or' operator is off. The variable $sername is continuously changing in an outer loop (not shown), but at the... (4 Replies)
Hi
What is the syntax for if statement using && and || operator?
if && ] ||
here its giving me an error to this if statement
any suggestion?? (2 Replies)
awk -F '/' '{ if (($2!="30") print }' f.dat > date_mismatch.dat
The above command is giving the desired results
But I would want use Or in the above but it is returning the complete file
awk -F '/' '{ if ($2!="30"||$2!="31") print }' f.dat > date_mismatch.dat
Have tried the... (1 Reply)
Hi,
I've tried searching through the forum but I've drawn a blank so i'm going to post here. I'm developing a number of checks on a CSV file, trying to find if any are greater than a max limit. I'm testing it by running it from a command line.
The file I'm testing has 8 records. When I... (3 Replies)
Hi
While calculating the sum of 6 and 7 fileds it is calculate the wrong value because of floating point like 7898778.10
awk '
BEGIN { FS = OFS = "|"
}
NR == 1 {
next
}
{ UX = $1 OFS $3 OFS $4 OFS $5
p1 +=$6
p2 +=$7
}
END { for(i in UX)
... (8 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Hello All,
I have developed a script which selects a particular filed from a file ,trims it,searches for a particular pattern and then mail it when found.
cat test_file.txt |sed -n '5,$p'|sed -e 's/ //g'|awk -F'|' '{if ($4 !="Alive") print $1,$2,$3,$4}' >> proc_not_alive.txt
It is... (4 Replies)
how can i use like operator in IF statement. Below is correct format, please guide
if ; then
CT_ACT_FILE_NAME=`echo FINACLE'
else
CT_ACT_FILE_NAME=`echo not listed'
fi
---------- Post updated at 04:58 PM ---------- Previous update was at 04:56 PM ----------
Please use CODE... (6 Replies)