Sorry for such a basic question, but I have spent hours trying to work this out! I need an awk command (or similar) that will look at a text file and output to the screen if the 4th column of each line has a value greater than or equal to x.
data.txt
This is the 1 line
This is the 2 line
This... (6 Replies)
I have a file which has a list of titles and then 14 lines afterwards. I need to find the 1 through 14 lines which are greater than 15k and print the title and the line which matched.
Sample before:
ABC.CDE.NORTH.NET
1:18427
2:302
3:15559
4:105
5:5
6:2
7:2
8:2
9:4
10:2
11:17
12:2... (3 Replies)
BASH problem with IS GREATER THAN OR EQUAL TO.
I have tried a dozen variations for this IF statement to work with IS GREATER THAN OR EQUAL TO. My code below WORKS.
array=( $( /usr/bin/sar -q 1 30 |grep Average |awk '{print $2,$3}' ) )
nthreads="${array}"
avproc="${array}"
if && ; then ... (6 Replies)
Hi
I want to find greater than and min value.
dategrep()
{
varlinenum=$1
varSESSTRANS_CL="$(egrep -n "<\/SESSTRANSFORMATIONINST>" tmpsess9580.txt | cut -d":" -f1)"
echo $varSESSTRANS_CL
}
dategrep 8
Output of the above command is:
I want to find out greater than 8 and... (9 Replies)
I have an output from db which looks like :
row1 row2 row3
abc 21.1 13
efg 21.1 45
ghi 21.1 75
when I apply following command ( cat my_output.txt | awk {'print $ 4' }
I have following output :
row3
13
45
75
now I want to figure out if... (4 Replies)
I have a file with multiple fields, example below
File 1:
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|100
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|101
Field 1|Field 2|Field 3|Field 4|Field 5|Field 6|Field 7|102
Field 1|Field 2|Field 3|Field 4|Field 5|Field... (4 Replies)
data.txt
August 09 17:16 2013
August 09 17:17 2013
August 09 17:19 2013
August 09 17:20 2013
August 09 17:21 2013
August 09 17:22 2013
August 09 17:23 2013
August 09 17:24 2013
to print from a point in this file, to the end of the file, i type:
awk '/August 09 17:22/,0' data.txt.
... (1 Reply)
I have large config-files for an application. The lines have different structure, but some of them contains the parameter 'TIMEOUT=x', where x is an numeric value. I want to change the value for that specific paramater if the value is greater than a specific value (got that?). The timeout-parameter... (3 Replies)
please let me know how to construct if then else by comparing two numbers if it is greater than 10000. I need to do some specific task executed.
can you help me out in shell scripting plz. (6 Replies)
Discussion started by: ramkumar15
6 Replies
LEARN ABOUT HPUX
test
test(1) General Commands Manual test(1)NAME
test - condition evaluation command
SYNOPSIS
expr
DESCRIPTION
The command evaluates the expression expr and, if its value is True, returns a zero (true) exit status; otherwise, a nonzero (false) exit
status is returned. also returns a nonzero exit status if there are no arguments. The following primitives are used to construct expr:
True if file exists and is readable.
True if file exists and is writable.
True if file exists and is executable.
True if file exists and is a regular file.
True if file exists and is a directory.
True if file exists and is a character special file.
True if file exists and is a block special file.
True if file exists and is a named pipe (fifo).
True if file exists and its set-user-ID bit is set.
True if file exists and its set-group-ID bit is set.
True if file exists and its sticky bit is set.
True if file exists and has a size greater than zero.
True if file exists and is a symbolic link.
True if the open file whose file descriptor number is
fildes (1 by default) is associated with a terminal device.
True if the length of string
s1 is zero.
True if the length of the string
s1 is non-zero.
True if strings
s1 and s2 are identical.
True if strings
s1 and s2 are not identical.
s1 True if s1 is not the null string.
True if the integers
n1 and n2 are algebraically equal. Any of the comparisons and can be used in place of
These primaries can be combined with the following operators:
Unary negation operator.
Binary AND operator.
Binary OR operator
has higher precedence than
Parentheses for grouping.
Note that all the operators and flags are separate arguments to Note also that parentheses are significant to the shell and therefore must
be escaped. All file test operators return success if the argument is a symbolic link that points to a file of the file type being tested.
is interpreted directly by the shell, and therefore does not exist as a separate executable program.
EXTERNAL INFLUENCES
International Code Set Support
Single byte and multibyte character code sets are supported.
EXAMPLES
Exit if there are not two or three arguments:
Create a new file containing the text string if the file does not already exist:
Wait for myfile to become non-readable:
WARNINGS
When the form of this command is used, the matching must be the final argument, and both must be separate arguments from the arguments they
enclose (white space delimiters required.
Parentheses and other special shell metacharacters intended to be handled by test must be escaped or quoted when invoking from a shell.
Avoid such problems when comparing strings by inserting a non-operator character at the beginning of both operands:
This approach does not work with numeric comparisons or the unary operators because it would affect the operand being checked.
AUTHOR
was developed by the University of California, Berkeley and HP.
SEE ALSO find(1), sh-posix(1), sh(1).
STANDARDS CONFORMANCE test(1)