Sponsored Content
Top Forums Shell Programming and Scripting find pattern, delete line with pattern and line above and line below Post 302281427 by pmm on Wednesday 28th of January 2009 10:46:32 PM
Old 01-28-2009
nawk ' /FRM CHK 0000/ { getline;getline;RECORD="" } !/FRM CHK 0000/ { if ( RECORD != "" ) print RECORD; RECORD=$0 } END { if ( RECORD != "" ) print RECORD } ' file
 

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. Shell Programming and Scripting

sed find matching pattern delete next line

trying to use sed in finding a matching pattern in a file then deleting the next line only .. pattern --> <ad-content> I tried this but it results are not what I wish sed '/<ad-content>/{N;d;}' akv.xml > akv5.xml ex, <Celebrant2First>Mickey</Celebrant2First> <ad-content> Minnie... (2 Replies)
Discussion started by: aveitas
2 Replies

3. 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

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

sed to find pattern and delete line before and after

I have the following file: line1 line2 MATCH line3 line4 I need to find the pattern, "MATCH" and delete the line before and after MATCH. So the result should be line1 MATCH lline4 I have to use sed because it is the only utility that is common across my environments. I... (1 Reply)
Discussion started by: craftereric
1 Replies

6. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

7. 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

8. Shell Programming and Scripting

Multiple pattern find and delete line

I have a file # cat /tmp/user_find.txt /home/user/bad_link1 /home/user/www /home/user/mail /home/user/access_logs /home/user/bad_link2 I need to delete lines where there are patterns /home/user/www, /home/user/mail and /home/user/access_logs. I used below method, but its throwing error... (8 Replies)
Discussion started by: anil510
8 Replies

9. Shell Programming and Scripting

awk to combine lines from line with pattern match to a line that ends in a pattern

I am trying to combine lines with these conditions: 1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text. 2. If condition1 is met then continue to combine lines through a line that ends with a semicolon. 3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
xtrap(1)						      General Commands Manual							  xtrap(1)

NAME
xtrapreset, xtrapinfo, xtrapstats, xtrapout, xtrapin, xtrapchar, xtrapproto - XTrap sample clients SYNTAX
xtrapreset [ -d[isplay] display ] xtrapinfo [ -d[isplay] display ] xtrapstats [ -d[isplay] display ] xtrapout [ -f script ] [ -e ] [ -d[isplay] display ] [ -v ] xtrapin [ -f script ] [ -d[isplay] display ] xtrapchar [ -v ] [ -d[isplay] display ] xtrapproto [ -d[isplay] display ] DESCRIPTION
These commands are SAMPLE CLIENTS provided with the XTrap X Server Extension Sources, Version 3.3. XTrap is an X Server extension which facilitates the capturing of server protocol and synthesizing core input events. Information on how to obtain these sources can be found in the SOURCES section below. The xtrapreset command is the simplest XTrap client in that it merely performs an XQueryExtension() against XTrap. The name "reset" is historical. The display argument is parsed by the X Toolkit and specifies the display where XTrap is to be loaded; see X(1). xtrapinfo displays general configuration information as a result of an GetAvailable XTrap request to the specified server. It is simply designed to test the request/response mechanism of the XTrap extension and client library as well as display the configuration information that it finds. xtrapstats tests the event and request vectoring of the server extension by configuring XTrap to collect usage statistics on all core input events and requests. It has a primitive command-line interface for showing the counters, zeroing out the counters, and quitting the pro- gram. xtrapout tests the output transport from the XTrap extension to the XTrap client library. As an aside, since xtrapout has the capability of "recording" events and requests it receives, xtrapout is ideal for providing input to test xtrapin. Since events are the only concern for the input transport, the -e flag can be specified to indicate that all input events (and only events) should be recorded by xtrapout. script is specified primarily for non-U*IX machines which don't support I/O re-direction easily. The -v flag is used to force recording of all requests and input events. xtrapin is used to test the input transport to the XTrap server extension. As stated earler, it's input can be provided by xtrapout using the -e qualifer. While it's primary function is for testing XTrap and serving as an example for XTrap functionality, it can reasonably used as a primitive "playback" client for X sessions. xtrapchar parses ANSI character sequences including application program sequences to synthesize input events to X Window servers using the XTrap server extension. The intent of this program is to serve as a sample implementation for interfacing character-based alternative input sources into X servers (e.g. voice recognition systems). Another application might be "remote keyboards". The -v flag causes the program to display XTrap configuration information and echo's characters processed to stdout. If present, this must be the first argument. Note: xtrapchar has only been used with Digital Workstations using the LK201 compatible keyboard. Though reasonable effort was done to maintain portability, no claims are made as to the current level of portability to non-DEC servers for this program. The xtrapproto command is a regression test designed to test the basic XTrap protocol between a client and server. If a given implementa- tion is suspect, the results of this test should be sent to an XTrap implementor and/or developer. OPTIONS
-d[isplay] display Specifies the server to record from or playback to; see -e Record only (and all) events. Should be used when creating input for -f script The pathname of the script to be recorded / played back. -v Verbose mode. DIAGNOSTICS
X Toolkit Error: Can't load DEC-XTRAP extension The XTrap X server extension has not been linked into the specified X server. SOURCES
Sources have been posted on UseNet systems via anonymous ftp. They are: East Coast (USA): export@lcs.mit.edu:contrib/XTrap_v32*.tar.Z West Coast (USA): gatekeeper@pa.dec.com:X11/contrib/XTrap_v32*.tar.Z IMPORTANT NOTE
Digital participated in the X Consortium's xtest working group which chose to evolve XTrap functionality into a new extension for X11/R6 known as the RECORD extension (XTrap input synthesis functionality is currently covered by the XTEST extension). It is strongly suggested that users of XTrap technology begin developing against RECORD/XTEST as it is the intention of the X Consortium to drive these two extensions in the standards process for providing the protocol capturing/synthesis functionality. Some members of the xtest working group are actively researching migration issues between XTrap and RECORD. If you'd like to contribute, please participate! Contact your local X Consortium Rep for details on how to be added to the xtest mailing list. If you encounter problems, have questions, etc. with XTrap, please contact via mail, phone, etc. at: Ken Miller miller@zk3.dec.com (VOICE) 603-881-6221 (FAX) 603 881-2257 or paper mail at: Digital Equipment Corp. Ken Miller @ ZKO3-3/Y25 110 Spitbrook Rd. Nashua, NH 03062 Naturally email is preferred and will get the fastest response. SEE ALSO
X(1) xtrap(1)
All times are GMT -4. The time now is 10:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy