Sponsored Content
Top Forums Shell Programming and Scripting [awk]compare a number in a string with a list Post 302498512 by sandeepk1611 on Monday 21st of February 2011 03:11:25 PM
Old 02-21-2011
Hi Radoulov,

I want to actually increment a counter everytime I get a match. The final count value is what I need. So every time I see a number in the commit message, I will compare with the list. If the number is present, count++ and then finally output count.

Thanks,
Sandeep
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String compare with list in shell script

Hi , I am new to shell scripting. below is my requirement : 1) while running my .sh i will pass a string 2) i have to extract a folder name under a /config folder 3) i need to compare a input string in the folder name list 4) if that is true i have to continue my job else i have to... (2 Replies)
Discussion started by: rajinavaneethan
2 Replies

2. Shell Programming and Scripting

awk conditional expression to compare field number and variable value

Hi, I'm trying to compare the value in a field to the value in a variable using awk. This works: awk '$7 == "101"'but this is what I want (and it doesn't work): value=101 awk '$7 == "$value"' Any help or insight on this would be great. Thanks in advance. (1 Reply)
Discussion started by: goodbenito
1 Replies

3. Shell Programming and Scripting

Compare strings between 2 arrays and print number in AWK

Hi to everyone, Please some help over here. Hi have array a with 6 elements and array b with 3 elements as shown inside BEGIN{} statement. I need help to get the correct sintax (the part in red) to compare if string from array b is in array a and print the number related for each match.... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

4. Shell Programming and Scripting

awk to compare hex number

$ awk 'BEGIN{ pat111=0x1000000002E3E02; snBegin=0x1000000002E3E01; if (pat111<=snBegin) printf "a\n"}' a Result is not correct. Looks like the number is too big. Any idea? Thx! Please use code tags <- click the link! (2 Replies)
Discussion started by: carloszhang
2 Replies

5. Shell Programming and Scripting

awk if statement to evaluate string and compare

I have the following simplified code that I am planning on putting into a larger shell script. I have been butchering it to try and make work amongst google searches and reading awk documentation. amixer sset Master toggle | awk '{ if ( /^ Front Left/ { print $7 } == // ) print "MUTED" }'I... (2 Replies)
Discussion started by: jelloir
2 Replies

6. Shell Programming and Scripting

awk - how to compare part of the string?

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

7. Shell Programming and Scripting

String compare using awk - what am I doing wrong?

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

8. Shell Programming and Scripting

Pass column number as variable to awk and compare with a string.

Hi All, I have a file test.txt. Content of test.txt : 1 vinay se 2 kumar sse 4 kishore tl I am extracting the content of file with below command. awk '$2 ~ "vinay" {print $0}' test.txt Now instead of hardcoding $2 is there any way pass $2 as variable and compare with a... (7 Replies)
Discussion started by: Girish19
7 Replies

9. Shell Programming and Scripting

Compare string length to a number

Hi, I want to compare strings length to a number but i am getting error. I want first name should be length of 8. Please help. #bin !/bin/bash clear echo -n "Enter name " read name IFS=_ ary=($name) for key in "${!ary}"; do echo "$key${ary}"; done ##First name should be equal to 8... (8 Replies)
Discussion started by: rajneesh4U
8 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

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
GLBEGINQUERY(3G)						    OpenGL 3.3							  GLBEGINQUERY(3G)

NAME
glBeginQuery - delimit the boundaries of a query object C SPECIFICATION
void glBeginQuery(GLenum target, GLuint id); PARAMETERS
target Specifies the target type of query object established between glBeginQuery and the subsequent glEndQuery(). The symbolic constant must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. id Specifies the name of a query object. C SPECIFICATION
void glEndQuery(GLenum target); PARAMETERS
target Specifies the target type of query object to be concluded. The symbolic constant must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. DESCRIPTION
glBeginQuery and glEndQuery() delimit the boundaries of a query object. query must be a name previously returned from a call to glGenQueries(). If a query object with name id does not yet exist it is created with the type determined by target. target must be one of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, GL_PRIMITIVES_GENERATED, GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or GL_TIME_ELAPSED. The behavior of the query object depends on its type and is as follows. If target is GL_SAMPLES_PASSED, id must be an unused name, or the name of an existing occlusion query object. When glBeginQuery is executed, the query object's samples-passed counter is reset to 0. Subsequent rendering will increment the counter for every sample that passes the depth test. If the value of GL_SAMPLE_BUFFERS is 0, then the samples-passed count is incremented by 1 for each fragment. If the value of GL_SAMPLE_BUFFERS is 1, then the samples-passed count is incremented by the number of samples whose coverage bit is set. However, implementations, at their discression may instead increase the samples-passed count by the value of GL_SAMPLES if any sample in the fragment is covered. When glEndQuery is executed, the samples-passed counter is assigned to the query object's result value. This value can be queried by calling glGetQueryObject() with pname GL_QUERY_RESULT. If target is GL_ANY_SAMPLES_PASSED, id must be an unused name, or the name of an existing boolean occlusion query object. When glBeginQuery is executed, the query object's samples-passed flag is reset to GL_FALSE. Subsequent rendering causes the flag to be set to GL_TRUE if any sample passes the depth test. When glEndQuery is executed, the samples-passed flag is assigned to the query object's result value. This value can be queried by calling glGetQueryObject() with pname GL_QUERY_RESULT. If target is GL_PRIMITIVES_GENERATED, id must be an unused name, or the name of an existing primitive query object previously bound to the GL_PRIMITIVES_GENERATED query binding. When glBeginQuery is executed, the query object's primitives-generated counter is reset to 0. Subsequent rendering will increment the counter once for every vertex that is emitted from the geometry shader, or from the vertex shader if no geometry shader is present. When glEndQuery is executed, the primitives-generated counter is assigned to the query object's result value. This value can be queried by calling glGetQueryObject() with pname GL_QUERY_RESULT. If target is GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, id must be an unused name, or the name of an existing primitive query object previously bound to the GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN query binding. When glBeginQuery is executed, the query object's primitives-written counter is reset to 0. Subsequent rendering will increment the counter once for every vertex that is written into the bound transform feedback buffer(s). If transform feedback mode is not activated between the call to glBeginQuery and glEndQuery, the counter will not be incremented. When glEndQuery is executed, the primitives-written counter is assigned to the query object's result value. This value can be queried by calling glGetQueryObject() with pname GL_QUERY_RESULT. If target is GL_TIME_ELAPSED, id must be an unused name, or the name of an existing timer query object previously bound to the GL_TIME_ELAPSED query binding. When glBeginQuery is executed, the query object's time counter is reset to 0. When glEndQuery is executed, the elapsed server time that has passed since the call to glBeginQuery is written into the query object's time counter. This value can be queried by calling glGetQueryObject() with pname GL_QUERY_RESULT. Querying the GL_QUERY_RESULT implicitly flushes the GL pipeline until the rendering delimited by the query object has completed and the result is available. GL_QUERY_RESULT_AVAILABLE can be queried to determine if the result is immediately available or if the rendering is not yet complete. NOTES
If the query target's count exceeds the maximum value representable in the number of available bits, as reported by glGetQueryiv() with target set to the appropriate query target and pname GL_QUERY_COUNTER_BITS, the count becomes undefined. An implementation may support 0 bits in its counter, in which case query results are always undefined and essentially useless. When GL_SAMPLE_BUFFERS is 0, the samples-passed counter of an occlusion query will increment once for each fragment that passes the depth test. When GL_SAMPLE_BUFFERS is 1, an implementation may either increment the samples-passed counter individually for each sample of a fragment that passes the depth test, or it may choose to increment the counter for all samples of a fragment if any one of them passes the depth test. The query targets GL_ANY_SAMPLES_PASSED, and GL_TIME_ELAPSED are availale only if the GL version is 3.3 or higher. ERRORS
GL_INVALID_ENUM is generated if target is not one of the accepted tokens. GL_INVALID_OPERATION is generated if glBeginQuery is executed while a query object of the same target is already active. GL_INVALID_OPERATION is generated if glEndQuery() is executed when a query object of the same target is not active. GL_INVALID_OPERATION is generated if id is 0. GL_INVALID_OPERATION is generated if id is the name of an already active query object. GL_INVALID_OPERATION is generated if id refers to an existing query object whose type does not does not match target. SEE ALSO
glDeleteQueries(), glGenQueries(), glGetQueryiv(), glGetQueryObject(), glIsQuery() COPYRIGHT
Copyright (C) 2005 Addison-Wesley. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. OpenGL 3.3 03/08/2011 GLBEGINQUERY(3G)
All times are GMT -4. The time now is 07:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy