Sponsored Content
Top Forums Shell Programming and Scripting selecting a line and line above it. Post 302224783 by era on Thursday 14th of August 2008 02:49:04 AM
Old 08-14-2008
Code:
grep -A 1 -B 1 Lock-wait file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Selecting a line value

Hello, I just wanted to know if there is a way in UNIX to select a line value from a list of words. there is no line number before each word, hence could not use grep. (4 Replies)
Discussion started by: unibboy
4 Replies

2. UNIX for Dummies Questions & Answers

Selecting line ahead and next using AWK or SED

:confused: Good Day, I have this script that gets the archive names and the time it applies based on the alert log. The application of archives are of daily basis and usually many so having this script helps my job become easier. My problem is that when i get all the time stamps and... (1 Reply)
Discussion started by: ownins
1 Replies

3. UNIX for Dummies Questions & Answers

Selecting specific line using awk

Hi, I would like to get the specific line from the file taking specific coloumn as reference. Thanks and Regards (1 Reply)
Discussion started by: kkarthik_kaja
1 Replies

4. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

5. Shell Programming and Scripting

Help in selecting line numbers between two values

Hi! I've a file as shown below 1 hello 2 how 5 are 3 you 4 hello 5 world Every statement consists of line numbers at the beginning which are not in sequence. Now I want to select all the line numbers which are present between the line numbers specified by the user.. For example... (1 Reply)
Discussion started by: abk07
1 Replies

6. Shell Programming and Scripting

how to read the contents of two files line by line and compare the line by line?

Hi All, I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Discussion started by: mjavalkar
4 Replies

7. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

8. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

9. Shell Programming and Scripting

Comparing two one-line files and selecting what does not match

I have two files. One is consisting of one line, with data separated by spaces and each number appearing only once. The other is consisting of one column and multiple lines which can have some numbers appearing more than once. It looks something like this: file 1: 20 700 15 30 file2: 10... (10 Replies)
Discussion started by: maya3
10 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
CGI::Application::Dispatch::Regexp(3pm) 		User Contributed Perl Documentation		   CGI::Application::Dispatch::Regexp(3pm)

NAME
CGI::Application::Dispatch::Regexp - Dispatch requests to CGI::Application based objects using regular expressions SYNOPSIS
use CGI::Application::Dispatch::Regexp; CGI::Application::Dispatch::Regexp->dispatch( prefix => 'MyApp', table => [ '' => { app => 'Welcome', rm => 'start' }, qr|/([^/]+)/?| => { names => ['app'] }, qr|/([^/]+)/([^/]+)/?| => { names => [qw(app rm)] }, qr|/([^/]+)/([^/]+)/page(d+).html?| => { names => [qw(app rm page)] }, ], ); DESCRIPTION
CGI::Application::Dispatch uses its own syntax dispatch table. "CGI::Application::Dispatch::Regexp" allows one to use flexible and powerful Perl regular expressions to transform a path into argument list. DISPATCH TABLE
The dispatch table should contain list of regular expressions with hashref of corresponding parameters. Hash element 'names' is a list of names of regular expression groups. The default table looks like this: table => [ qr|/([^/]+)/?| => { names => ['app'] }, qr|/([^/]+)/([^/]+)/?| => { names => [qw(app rm)] }, ], Here's an example of defining a custom 'page' parameter: qr|/([^/]+)/([^/]+)/page(d+).html/?| => { names => [qw(app rm page)] }, COPYRIGHT &; LICENSE Copyright Michael Peters and Mark Stosberg 2008, all rights reserved. SEE ALSO
CGI::Application, CGI::Application::Dispatch perl v5.14.2 2011-11-26 CGI::Application::Dispatch::Regexp(3pm)
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy