Sponsored Content
Full Discussion: If both condition satisfied
Top Forums Shell Programming and Scripting If both condition satisfied Post 302890463 by Roozo on Thursday 27th of February 2014 01:05:59 AM
Old 02-27-2014
If both condition satisfied

Code:
pattern
tin loop 3 
tin xarg 1
tin jim  5
tin icon 2 
tin tour 4

patn.out
tin loop 3
tin jim  5
tin icon 1 
tin tour 2

while read one two three
do
awk '$2 ~ /'"$two"'/' patn.out || while read four five six
do
awk -v n1=$three -v n2=$six '{BEGIN (n2<n1)?1:0}'
done<patn.out
done<pattern

my first check is to search a pattern in column 2 of file patn.out and if first is true then check
whether variable $three is less than $six, if it is less than i want to write those lines to a flat file
Code:
Output needed for above input:
tin xarg 1            		 ---> xarg i failed in first awk so written in output file
tin icon 2 
tin tour 4

From the above code, I can able to test whether it is less than or not but as we know it is displaying the output
which satisfied in first awk

Do we have single awk line to solve this? if so can you plz explain the command
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

if condition ...

i have following if condition if above statement is case sensitive.....what is syntax if i have to make above comparision case insensetive (4 Replies)
Discussion started by: mahabunta
4 Replies

2. Shell Programming and Scripting

print remaining file after a condition is satisfied

Hi , could any one suggest me that how to determine if the first field is numeric and if it is greater than another number then from that point everything else should be printed using awk. I have tried this : awk -v xxxx=$xxxxx ' BEGIN { enable=0 } { print $1 if ( ( $1 !~ "^*$" ... (5 Replies)
Discussion started by: hitmansilentass
5 Replies

3. Shell Programming and Scripting

how to create folder wen the condition satisfied

hi i hav files ha1j ha2m ha3n ha4q ha5s ...like tat im having some 20 files ..and i want to create a folder as the same amount of files which im having wen the condition if loop is satisfied .. thank you (5 Replies)
Discussion started by: maximas
5 Replies

4. UNIX for Dummies Questions & Answers

Changing old file name to new one if the old file name satisfied certain condition

Hi guys, I desperately need your help on my problem:- I got a folder in my directory that has many files in it. Most of the file's name is starting with certain prefix. Eg: ABC, CDE, EFG, etc. I only want to change file name that is starting from certain prefix and the rest I want them to... (1 Reply)
Discussion started by: balzzz
1 Replies

5. UNIX for Dummies Questions & Answers

until loop : running even if condition is satisfied

I am checking one until loop with the following logic until || |||| do sleep 30 done before running this i am exporting above variables to SUCCESS.But the loop is running in infinite loop.My requirement is to make the loop run until all the 3 variables are SUCCESS or any of the 3... (2 Replies)
Discussion started by: dr46014
2 Replies

6. Shell Programming and Scripting

or in a IF condition

Hi I have to evaluate multiple conditions with an 'or'. Here is an example: if when i use the above i get a error message ' Please help me to know if i am missing something in the syntax. how do i achieve multiple "or" in the same if condition. Thanks. (11 Replies)
Discussion started by: sunrexstar
11 Replies

7. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

8. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

9. Shell Programming and Scripting

if condition

if chr1:109457160 1 109457160 99.1735537190083 + chr1:109457233 1 109457233 99.1735537190083 - chr1:109457614 1 109457614 99.1735537190083 + chr1:109457618 1 109457618 100 + chr1:109457943 1 109457943 100 - chr1:109458224 1 109458224 99.1735537190083 - file1.txt If 6th column in... (3 Replies)
Discussion started by: johnkim0806
3 Replies

10. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
vala-gen-project(1)						   USER COMMANDS					       vala-gen-project(1)

NAME
vala-gen-project - generate the and automake skeleton for your vala project SYNOPSIS
vala-gen-project [OPTION...] [NAME] DESCRIPTION
Vala project generator is a little gui or command line utility that creates an automake project skeletoni vala program. It can be used without specifying a project name, so that a gtk+ gui will be presented or directly from the command line. OPTIONS
-?, --help Show help options -p, --projectdir=DIRECTORY Project directory -t, --type=TYPE Project TYPE: gtk+, console -l, --license=TYPE License TYPE: gpl2, gpl3, lgpl2, lgpl2.1, lgpl3, apache2, artistic --version Display version number -a, --author=NAME Author name -e, --email=EMAIL Author email address EXAMPLES
Create a gtk+ project with a gpl2 license and the name valatest vala-gen-project -t gtk+ -l gpl2 valatest EXIT STATUS
vala-gen-project returns a zero exist status if it succeed. Non zero is returned in case of failure. AUTHOR
Andrea Del Signore (sejerpz (at) tin.it) SEE ALSO
valac(1) version 0.1.0 December 24, 2008 vala-gen-project(1)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy