Sponsored Content
Top Forums UNIX for Advanced & Expert Users Need command for grepping pattern lines with subsequent lines Post 302776355 by CarloM on Wednesday 6th of March 2013 07:47:57 AM
Old 03-06-2013
Also, what's your OS? (more specifically, do you have GNU grep?)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace only 1st word of a line if it comes in the subsequent lines at same postion.

I have a file like this.. Maharastra Mumbai worli Maharastra Mumbai navy maharatra Pune Maharastra Nagpur Karnataka Bangalore Karnataka Mysore Karnataka Mangalore Punjab Amritsar punjab Jalandar my expected outcome should be like this Maharastra Mumbai worli ---------- ... (9 Replies)
Discussion started by: geeko
9 Replies

2. Shell Programming and Scripting

How to extract a substring and append to subsequent lines

Hi all,I am really new to Shell Scripting.I have the following doubt. Let us assume the one sample file which contains the below data HEADERCARMENTRACIE1555090414 PERIOD0905090501090531 DETAIL0645693037023073836 GROUNDAV 090501 01 GROUNDAV 090502 01 TRIP 0091282542 0905084101... (5 Replies)
Discussion started by: jaligamasriniva
5 Replies

3. Shell Programming and Scripting

How to search for keywords in subsequent lines

Hi all, I am looking for a coomand to search for the keywords in susequenct lines. Keyword1 in a line and Keyword2 in the very next line. Once i found the combination ineed to print the lines with patterns and the line above and one below. I am giving an example here: Keywords are :ERROR and... (12 Replies)
Discussion started by: rdhanek
12 Replies

4. Shell Programming and Scripting

search for keyword in subsequent lines and delete the second line

I have my data something like this I need to search for the keyword yyyy in the susequent lines and if it is present, delete the second line with keyword. In other words, if a keywords is found in two subsequent lines delete the second line. input data: aaaa bbbbb cccc dddd xxxx... (4 Replies)
Discussion started by: rdhanek
4 Replies

5. Shell Programming and Scripting

Grep and fetch subsequent lines also

Hi, I need to grep a pattern and fetch subsequent lines till end of the data-set. E.g., i have a file like: AA 1111 23 34 BB 45 56 78 CC 22 44 AA 2222 78 34 56 BB 22 56 67 68 23 CC 56 78 DD 33 55 77 AA 3333 46 BB 58 79 In above file i have 3-data sets where each set starts with... (6 Replies)
Discussion started by: prvnrk
6 Replies

6. Shell Programming and Scripting

Find pattern, and then last field from subsequent lines

I've got a log file, of the format Name: network1 Dropped packets: 15618 Dropped packets for IPv6: 27 Dropped packets: 74 Dropped packets for IPv6: 0 Failed RADIUS Authentication procedures: 0 Failed RADIUS Accounting procedures: 0 Name: network2 Dropped packets: 1117 ... (18 Replies)
Discussion started by: Yorkie99
18 Replies

7. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

8. Shell Programming and Scripting

awk - use fields from subsequent lines

I've run into a problem getting exactly what I want out of awk - some folks may recognize this as an output from Amazon's ec2-describe-instances: Given the following: INSTANCE i-4960f321 BLOCKDEVICE Line2Var2 TAG instance i-4960f321 Name web1 TAG instance i-4960f321... (2 Replies)
Discussion started by: colinjohnson
2 Replies

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

10. Shell Programming and Scripting

Printing next two lines from a file after grepping a specific pattern

Hi I have a file like # vi require.txt 1,BANK,Read blocks that cycle. yellow Read blocks. 2,ACCOUNT,Finished Red Finished . 3,LOAN, pipe white pipe 4,PROFIT,Resolve. black Resolve Am using like cat require.txt | grep -w ACCOUNTThe output I get is (8 Replies)
Discussion started by: Priya Amaresh
8 Replies
CHDB(7) 						 Miscellaneous Information Manual						   CHDB(7)

NAME
chdb - chess database browser SYNOPSIS
chdb [ file ... ] DESCRIPTION
Chdb reads the given files of chess games (hist by default) and accepts commands to search, play through, and display the games in these files. If x is the name of the file, it is looked for under the names x, x.m.out, and /lib/chess/x.m.out. After reading the files, chdb displays a chess board, a text window with a command line, and vertical and horizontal scroll bars along the edges of the board. The text window holds 6 lines of information about the game and position and, at the bottom, a command line in which to type. The displayed text contains chess symbols--use a suitable font. The vertical scroll bar scans through the games to select a game; the horizontal bar then scans through the moves of the selected game. Both scroll bars use button 1 to scan backwards, button 3 to scan forwards, and button 2 to jump to an absolute position. With buttons 1 and 3, the scroll bars are calibrated in units of 1 through 8 corresponding to the ranks and files of the board. The units measure games on the vertical scroll bar, ply (half-moves) on the horizontal scroll bar. For example, clicking button 3 on the horizontal scroll bar under the d file steps through the game two full moves. Moves may be made on the chess board by pointing with button 1. There are two methods to point at moves. For the first method, point at the piece to be moved, press button 1, point to the place to move that piece, and release button 1. In the second method, point at the place where a piece is to move and press button 1. The smallest/least-central piece that can move there is highlighted. Releasing button 1 without moving the mouse will make the highlighted move. Moving the mouse to the desired piece and releasing the button will move the selected piece. Typed lines of text are echoed in the command line and executed. The available commands are: f n n Set the format for display of moves in the text window. The first number is the verbosity, with 0 minimal. The second number is 0 for algebraic, 1 for English, and 2 for figurine (default). g n Go to the game with ordinal number n in the input files. If n is prefixed with a + or -, it is interpreted as a relative position in the current set of games (see below). N defaults to +1. p n Go to whole move n in the current game. If n is prefixed with a + or -, it is interpreted as an offset in ply from the current position. N defaults to +1. k n Mark the current set of games with tag n (see patterns, below). w type file Write the current set of games to file. Type is either a (write the games as text) or m (write the games in binary format suitable for chdb). Patterns select subsets of the games. A pattern is one of the following, in decreasing precedence order. Parentheses can be used for grouping. . The current game. * All games originally read. 'n The games previously marked with a k command with the same n. [] [number] All games in * that contain the positions that can be reached in the specified number of plies from the current position. A missing number is the same as zero, meaning just the current position. Positions are matched with black/white transpositions. /regular expression/fields This pattern matches the regular expression against the various text windows. Fields is a list of characters from the set abdefo- prw. A is for all, b for black, d for date, e for event, f for file, o for opening, p for person (white and black), r for result, and w for white. If multiple fields are given, the expression is matched on the union of the specified fields. If no field is given, p is assumed. !pattern The set subtraction of * and the given pattern. pattern-pattern The set subtraction of the given patterns. pattern+pattern pattern|pattern The set union of the given patterns. pattern pattern pattern&pattern The set intersection of the given patterns. +pattern -pattern &pattern |pattern These patterns have the current set of games as an implied first operand. EXAMPLE
Select games that Botvinnik lost: (/Botv/w/0-1/r)|(/Botv/b/1-0/r) FILES
/lib/chess directory of databases. SOURCE
/sys/src/cmd/chdb SEE ALSO
regexp(6). BUGS
The browser is only a prototype. Most of the databases are protected by copyright and not distributed. CHDB(7)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy