Sponsored Content
Top Forums Shell Programming and Scripting Pass column number as variable to awk and compare with a string. Post 302924733 by junior-helper on Wednesday 12th of November 2014 05:44:32 AM
Old 11-12-2014
RudiC,
I don't know why, but it works (I always test the commands before posting them).
I also think there is (almost) no difference between my 2 proposals.
If the first would fail, the second would fail too, no(?)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help with counting of files then pass number to variable

hi all, i'm trying to pass a count of files to a variable thru these set of codes: sh_count=$(ls -1 fnd_upload_LV*.* |wc -l) problem is if no files matches that, it will give an error "ls: fnd_upload_LV*.*: No such file or directory". how do i avoid having the shell script show that... (2 Replies)
Discussion started by: adshocker
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

[awk]compare a number in a string with a list

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

4. Solaris

awk - Print variable number of colums from a starting column

Hi guys, I usualy am able to google awk stuff but I can't find it so far and there are so many awking gurus here that I will give it a shot. I want to print $1;$3;"$5 up to the $NF". In other words, I can have 1000 colums, but need to have $5 up to the end. I started with the idea of... (2 Replies)
Discussion started by: plmachiavel
2 Replies

5. Shell Programming and Scripting

awk arrays - compare value in second column to variable

Hello, I am trying to redirect files to a directory by using a config file. The config files is as such: xxxxxx,ID,PathToDirectory xxxxxx,ID2,PathToDirectory2 and so on... I have a variable that should match one of these IDs. I want to load this config file into an awk array, and... (2 Replies)
Discussion started by: jrfiol
2 Replies

6. Red Hat

pass a variable line number to sed

num=10 sed -n '$num p' test.txt sed -n '10 p' test.txt works however i am putting the sed command in a loop and the line number is not static Can someone please help me how to achive this. (1 Reply)
Discussion started by: figure20012
1 Replies

7. Shell Programming and Scripting

Help with compare two column and print out column with smallest number

Input file : 5 20 500 2 20 41 41 0 23 1 Desired output : 5 2 20 0 1 By comparing column 1 and 2 in each line, I hope can print out the column with smallest number. I did try the following code, but it don't look good :( (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. UNIX for Advanced & Expert Users

Pass variable to awk command search string

I must have forgot how to do this, but, I am attempting to enter a variable into an awk / gawk search pattern. I am getting a value from user input to place in a specific section of a 132 character string. my default command is .... gawk --re-interval '/^(.{3}P .{4}CYA.{8}1)/' ... (3 Replies)
Discussion started by: sdeevers
3 Replies

9. Shell Programming and Scripting

Search for string in column using variable: awk

I'm interested to match column pattern through awk using an external variable for data: -9 1:751343:T:A -9 0 T A 0.726 -5.408837e-03 9.576603e-03 7.967536e-01 5.722312e-01 -9 1:751756:T:C -9 0 T C 0.727 -5.360458e-03 9.579447e-03 7.966977e-01 5.757858e-01... (7 Replies)
Discussion started by: genome
7 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
GLSTENCILOP(3G) 														   GLSTENCILOP(3G)

NAME
glStencilOp - set stencil test actions C SPECIFICATION
void glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ) PARAMETERS
fail Specifies the action to take when the stencil test fails. Six symbolic constants are accepted: GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_DECR, and GL_INVERT. The initial value is GL_KEEP. zfail Specifies the stencil action when the stencil test passes, but the depth test fails. zfail accepts the same symbolic constants as fail. The initial value is GL_KEEP. zpass Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. zpass accepts the same symbolic constants as fail. The initial value is GL_KEEP. DESCRIPTION
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering. The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a refer- ence value. To enable and disable the test, call glEnable and glDisable with argument GL_STENCIL_TEST; to control it, call glStencilFunc. glStencilOp takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and fail specifies what happens to the stencil buffer contents. The fol- lowing six actions are possible. GL_KEEP Keeps the current value. GL_ZERO Sets the stencil buffer value to 0. GL_REPLACE Sets the stencil buffer value to ref, as specified by glStencilFunc. GL_INCR Increments the current stencil buffer value. Clamps to the maximum representable unsigned value. GL_DECR Decrements the current stencil buffer value. Clamps to 0. GL_INVERT Bitwise inverts the current stencil buffer value. Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2^n - 1, where n is the value returned by querying GL_STENCIL_BITS. The other two arguments to glStencilOp specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed (zpass) or fail (zfail) (see glDepthFunc). The actions are specified using the same six symbolic constants as fail. Note that zfail is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, fail and zpass specify stencil action when the stencil test fails and passes, respectively. NOTES
Initially the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil tests always pass, regardless of any call to glStencilOp. ERRORS
GL_INVALID_ENUM is generated if fail, zfail, or zpass is any value other than the six defined constant values. GL_INVALID_OPERATION is generated if glStencilOp is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_STENCIL_FAIL glGet with argument GL_STENCIL_PASS_DEPTH_PASS glGet with argument GL_STENCIL_PASS_DEPTH_FAIL glGet with argument GL_STENCIL_BITS glIsEnabled with argument GL_STENCIL_TEST SEE ALSO
glAlphaFunc, glBlendFunc, glDepthFunc, glEnable, glLogicOp, glStencilFunc GLSTENCILOP(3G)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy