Sponsored Content
Full Discussion: SED replacement
Top Forums Shell Programming and Scripting SED replacement Post 302514134 by Chubler_XL on Friday 15th of April 2011 12:15:58 AM
Old 04-15-2011
One idea - put space at front and back of each line, then replace <space>test<space> with <space>develop<space> then take spaces off front and back:

Code:
$ a=test
$ b=develop
$ echo "test and testing and test" | sed "s/^/ /;s/\$/ /;s/ $a / $b /g;s/^ //;s/ $//"
develop and testing and develop

But, I'm sure someone will come up with a better way but.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replacement using sed

Hi I have the following file that i need to run a sed command on 1<tab>running 2<tab>running 3<tab>running 4<tab>running I want to be able to replace a line i.e the second one with '2<tab>failed'. As the first number is unique that can be used to search for the relevant line (using ^2 i... (5 Replies)
Discussion started by: handak9
5 Replies

2. Shell Programming and Scripting

Complex sed replacement

Hi, I have a file that I would like to translate using sed. I can do some basic sed commands, but Im afraid this level is beyond me. I have this file - ...alter... .. ...65536... ... ...65536... ... ...alter... ... ...65536... etc What I would like to do is replace the first... (11 Replies)
Discussion started by: one_ring99
11 Replies

3. Shell Programming and Scripting

Need Replacement for sed

Hi Can anyone provide me the replacement of sed with xargs perl syntax for the below sed -e :a -e '/;$/!N;s/\n//; ta' -e 's/;$//' This should be without looping has to take minimal time for search (0 Replies)
Discussion started by: dbsurf
0 Replies

4. Shell Programming and Scripting

sed replacement, challenge one!!!!

Hi all, Thanks in advanced. This question really bothered me much. What i want is to replace any times of repeated 'TB' to 'T', below is example. It can be fullfil by AWK and perl, but my desire is using SED to realize it. So here means we treat TB as a whole part, which means 's/TB*/T/'... (4 Replies)
Discussion started by: summer_cherry
4 Replies

5. Shell Programming and Scripting

String replacement using sed

I need to search and replace a particular string in a file. Only the exact match of the string should be replaced. eg: File contents : abc abcd abcdef --> Replace only 'abc' with 'xyz', but it should not replace abcd with xyzd. So the o/p should be: xyz abcd abcdef. How can this be done? I... (5 Replies)
Discussion started by: sngk
5 Replies

6. Shell Programming and Scripting

Help with sed replacement

This seems like it should be an easy problem, but I'm a noob and I can't figure it out. I'm trying to use sed, but would be happy to use anything that does the job. I am trying to trim off a fixed number of unknown characters from 2 different : delimited fields while keeping the intervening... (4 Replies)
Discussion started by: helix_w
4 Replies

7. Shell Programming and Scripting

Replacement with sed

I am trying to replace the line which has string "tablespace" not case senstive.... with below simple script: mysrcipt.sh sed "s/.*/TABLESPACE USERS/g" create_table > tmp mv tmp create_table Is there any better way to do it? If Search string tooooooo long it will be tough to code in... (4 Replies)
Discussion started by: ganeshd
4 Replies

8. Shell Programming and Scripting

SED replacement of placeholders

Hi All, I am facing a problem while using SED in Linux. I have a property file which contains a string local.mds.dir=${basedir}/deployCompositesIt has be to replaced with another string, and value of that string should be initialized at runtime. So I use placeholder there. My substituted... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

9. Shell Programming and Scripting

sed replacement error

Hi ,"environment":"accent-release","build":"ac-1112_c_Alph_Nop-release_rele-1112_c_Alph_Nop-release_rele","tags":"" above is the config file, where in i want to replace value after build inside the double quotes... that value i'll be passing as parameter for example if m passing ... (1 Reply)
Discussion started by: nikhil jain
1 Replies

10. Shell Programming and Scripting

sed text replacement

Hello, I'm using Bash and Sed to replace text within a text file (1.txt) twice in one script. Using a for loop I'm initially replacing any 'apple' words with the variable 'word1' ("leg). I'm then using another for loop to replace any 'apple' words with the variable 'word2' ("arm"). This task is... (2 Replies)
Discussion started by: Flip-Flop
2 Replies
GLSTENCILOP(3G) 						  [FIXME: manual]						   GLSTENCILOP(3G)

NAME
glStencilOp - set front and back stencil test actions C SPECIFICATION
void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass); PARAMETERS
sfail Specifies the action to take when the stencil test fails. Eight symbolic constants are accepted: GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_INCR_WRAP, GL_DECR, GL_DECR_WRAP, and GL_INVERT. The initial value is GL_KEEP. dpfail Specifies the stencil action when the stencil test passes, but the depth test fails. dpfail accepts the same symbolic constants as sfail. The initial value is GL_KEEP. dppass 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. dppass accepts the same symbolic constants as sfail. 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 reference value. To enable and disable the test, call glEnable() and glDisable() with argument GL_STENCIL_TEST; to control it, call glStencilFunc() or glStencilFuncSeparate(). There can be two separate sets of sfail, dpfail, and dppass parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. glStencilOp() sets both front and back stencil state to the same values. Use glStencilOpSeparate() to set front and back stencil state to different values. 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 sfail specifies what happens to the stencil buffer contents. The following eight 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_INCR_WRAP Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value. GL_DECR Decrements the current stencil buffer value. Clamps to 0. GL_DECR_WRAP Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero. 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 (dppass) or fail (dpfail) (see glDepthFunc()). The actions are specified using the same eight symbolic constants as sfail. Note that dpfail is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, sfail and dppass 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. glStencilOp() is the same as calling glStencilOpSeparate() with face set to GL_FRONT_AND_BACK. ERRORS
GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the defined constant values. ASSOCIATED GETS
glGet() with argument GL_STENCIL_FAIL, GL_STENCIL_PASS_DEPTH_PASS, GL_STENCIL_PASS_DEPTH_FAIL, GL_STENCIL_BACK_FAIL, GL_STENCIL_BACK_PASS_DEPTH_PASS, GL_STENCIL_BACK_PASS_DEPTH_FAIL, or GL_STENCIL_BITS glIsEnabled() with argument GL_STENCIL_TEST SEE ALSO
glBlendFunc(), glDepthFunc(), glEnable(), glLogicOp(), glStencilFunc(), glStencilFuncSeparate(), glStencilMask(), glStencilMaskSeparate(), glStencilOpSeparate() COPYRIGHT
Copyright (C) 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. [FIXME: source] 05/30/2012 GLSTENCILOP(3G)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy