Sponsored Content
Full Discussion: Delete line contains pattern
Top Forums Shell Programming and Scripting Delete line contains pattern Post 302527804 by radoulov on Sunday 5th of June 2011 02:34:08 PM
Old 06-05-2011
Code:
printf '/%s/d\nwq' "$pattern" | ex -s infile

If I recall correctly, some versions of ex require something like this:

Code:
printf '/%s/d\nw\nq' "$pattern" | ex -s infile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comment/delete a particular pattern starting from second line of the matching pattern

Hi, I have file 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies

2. UNIX for Dummies Questions & Answers

find pattern delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: W/D FRM CHK 00 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (1 Reply)
Discussion started by: nickg
1 Replies

3. Shell Programming and Scripting

find pattern, delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: FRM CHK 0000 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (4 Replies)
Discussion started by: nickg
4 Replies

4. UNIX for Dummies Questions & Answers

Find Pattern delete line and next line

I am trying to delete the line with pattern and the next line. Found the below command in forum which also deleted the previous line. how should i modify that to make sure that only the line with pattern and the next line are deleted but not the previous line? awk '/key... (1 Reply)
Discussion started by: rdhanek
1 Replies

5. Shell Programming and Scripting

Delete line before pattern

Hi All, I want to delete partial line before the INSERT. Input: l_s := ' INSERT INTO TEST' Output: INSERT INTO TEST' (3 Replies)
Discussion started by: saurabhbaisakhi
3 Replies

6. Shell Programming and Scripting

delete line after pattern

Hi, Before insert, delete everything. If ' available before insert, then we need to keep this. Input: ==== l_s := ' INSERT INTO TEST1' INSERT INTO TEST2 Output: ==== 'INSERT INTO TEST' INSERT INTO TEST2 (2 Replies)
Discussion started by: saurabhbaisakhi
2 Replies

7. Shell Programming and Scripting

delete line containing a pattern!!!

if the given pattern exists in the file with the very next line starting and ending with the same pattern , delete the line that starts and ends with the given pattern. So upon running on this file ===================== hai people<PATTERN> we had <PATTERN>a lot of fun<PATTERN> ... (1 Reply)
Discussion started by: jacky29
1 Replies

8. Homework & Coursework Questions

delete line containing a pattern!!!

if the given pattern exists in the file with the very next line starting and ending with the same pattern , delete the line that starts and ends with the given pattern. So upon running on this file ===================== hai people<PATTERN> we had <PATTERN>a lot of fun<PATTERN> ... (1 Reply)
Discussion started by: jacky29
1 Replies

9. Shell Programming and Scripting

delete next line of the given pattern

How to delete the next lines of the below pattern matches a certain criteria using sed it is rainy heavily<name> <name> how is it there <name> gfhafje qwfwfqw eeqewqrt <name> there is heavy raining <name> so that the output will be it is rainy heavily<name> gfhafje qwfwfqw... (2 Replies)
Discussion started by: tkmmelvin
2 Replies

10. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies
GLLINESTIPPLE(3G)														 GLLINESTIPPLE(3G)

NAME
glLineStipple - specify the line stipple pattern C SPECIFICATION
void glLineStipple( GLint factor, GLushort pattern ) PARAMETERS
factor Specifies a multiplier for each bit in the line stipple pattern. If factor is 3, for example, each bit in the pattern is used three times before the next bit in the pattern is used. factor is clamped to the range [1, 256] and defaults to 1. pattern Specifies a 16-bit integer whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first; the default pattern is all 1's. DESCRIPTION
Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the 16-bit line stipple pattern pattern, the repeat count factor, and an integer stipple counter s. Counter s is reset to 0 whenever glBegin is called, and before each line segment of a glBegin(GL_LINES)/glEnd sequence is generated. It is incremented after each fragment of a unit width aliased line segment is generated, or after each i fragments of an i width line segment are generated. The i fragments associated with count s are masked out if pattern bit (s / factor) mod 16 is 0, otherwise these fragments are sent to the frame buffer. Bit zero of pattern is the least significant bit. Antialiased lines are treated as a sequence of 1 * width rectangles for purposes of stippling. Whether rectagle s is rasterized or not depends on the fragment rule described for aliased lines, counting rectangles rather than groups of fragments. To enable and disable line stippling, call glEnable and glDisable with argument GL_LINE_STIPPLE. When enabled, the line stipple pattern is applied as described above. When disabled, it is as if the pattern were all 1's. Initially, line stippling is disabled. ERRORS
GL_INVALID_OPERATION is generated if glLineStipple is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_LINE_STIPPLE_PATTERN glGet with argument GL_LINE_STIPPLE_REPEAT glIsEnabled with argument GL_LINE_STIPPLE SEE ALSO
glLineWidth, glPolygonStipple GLLINESTIPPLE(3G)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy