Sponsored Content
Full Discussion: grep string & next n lines
Top Forums Shell Programming and Scripting grep string & next n lines Post 90260 by ashterix on Monday 21st of November 2005 06:35:05 AM
Old 11-21-2005
grep string & next n lines

need help on this. let say i hv 1 file contains as below:

STRING
Description bla bla bla
Description yada yada yada
Data bla bla
Data yada yada


how do i want to display n lines after the string?

thanks in advance!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep string but also it will show the next 5 lines

Hi experts, I want to grep a number 9366109380 from a file but it will also show me the next 5 lines. Below is the example- when i grep 989366109380, i can also see the next 5 lines. Line 1. <fullOperation>MAKE:NUMBER:9366109380:PPAY2;</fullOperation> Line 2.... (10 Replies)
Discussion started by: thepurple
10 Replies

2. Shell Programming and Scripting

grep string & a few lines after

i need to grep a STRING_A & the next few lines after the STRING_A example file: STRING_A yada yada line 1 line 2 STRING_B yada yada line 1 line 2 line 3 STRING_A yada yada line 1 line 2 line 3 line 4 STRING_A yada yada line 1 line 2 line 3 line 4 (7 Replies)
Discussion started by: ashterix
7 Replies

3. Shell Programming and Scripting

Like grep -v for a string over 2 lines? Sed?

Hi, I have a log file that I need to monitor as it's being written to, and I want to exclude certain strings from the output. At the moment I'm using ... tail -f LogFileName_`date +%d`.log | egrep -v "First String To Exclude | 2nd string | 3rd string" ...which works OK - but now I need to... (1 Reply)
Discussion started by: jake657
1 Replies

4. Shell Programming and Scripting

Print lines between two lines after grep for a text string

I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like: <ROW> some information more information </ROW> I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Discussion started by: jbruce
7 Replies

5. Shell Programming and Scripting

Find a string using grep & print the line above or below that.

Hi All, Please tell me how can I Find a string using grep & print the line above or below that in solaris? Please share as I am unable to use grep -A or grep -B as it is not working on Solaris. (10 Replies)
Discussion started by: Zaib
10 Replies

6. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

7. Shell Programming and Scripting

Grep couple of consecutive lines if each lines contains certain string

Hello, I want to extract from a file like : 20120530025502914 | REQUEST | whatever 20120530025502968 | RESPONSE | whatever 20120530025502985 | RESPONSE | whatever 20120530025502996 | REQUEST | whatever 20120530025503013 | REQUEST | whatever 20120530025503045 | RESPONSE | whatever I want... (14 Replies)
Discussion started by: black_fender
14 Replies

8. Shell Programming and Scripting

Grep last two lines, calc & adding comments

....... 06/09/2013|12:00:00 PM|3|26112|40|44032|27419.7|6 1 0 93 |6|1|0|93 06/09/2013|12:30:00 PM|3|26112|40|44032|27491|11 4 0 85 |11|4|0|85 I have "sysperf.out" file containing the lines above. What I like to have on the output is: Node: prod1db ===> this is the hostname Date:... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

9. Shell Programming and Scripting

Grep a string and count following lines starting with another string

I have a large dataset with following structure; C 0001 Carbon D SAR001 methane D SAR002 ethane D SAR003 propane D SAR004 butane D SAR005 pentane C 0002 Hydrogen C 0003 Nitrogen C 0004 Oxygen D SAR011 ozone D SAR012 super oxide C 0005 Sulphur D SAR013... (3 Replies)
Discussion started by: Syeda Sumayya
3 Replies

10. Shell Programming and Scripting

Grep three consecutive lines if each lines contains certain string

say we have : 2914 | REQUEST | whatever 2914 | RESPONSE | whatever 2914 | SUCCESS | whatever 2985 | RESPONSE | whatever 2986 | REQUEST | whatever 2990 | REQUEST | whatever 2985 | RESPONSE | whatever 2996 | REQUEST | whatever 2010 | SUCCESS | whatever 2013 | REQUEST | whatever 2013 |... (7 Replies)
Discussion started by: Saumitra Pandey
7 Replies
Module::Install::PAR(3pm)				User Contributed Perl Documentation				 Module::Install::PAR(3pm)

NAME
Module::Install::PAR - Module::Install Support for PAR::Dist packages SYNOPSIS
To offer your users the possibility to install binaries if we cannot compile an XS version of the module, you could use this simplistic stub: use inc::Module::Install; name 'Foo'; all_from 'lib/Foo.pm'; # Which CPAN directory do we fetch binaries from? par_base 'SMUELLER'; unless ( can_xs ) { my $okay = extract_par( fetch_par ); if (not $okay) { die "No compiler and no binary package found. Aborting. "; } } WriteAll; DESCRIPTION
This module adds a couple of directives to Module::Install related to installing and creating PAR::Dist distributions. par_base This directive sets the CPAN ID from whose CPAN directory to fetch binaries from. For example, you can choose to download binaries from http://www.cpan.org/authors/id/S/SM/SMUELLER/ or its ftp counterpart by writing: par_base 'SMUELLER'; By default, the name of the file to fetch is generated from the distribution name, its version, your platform name and your perl version concatenated with dashes. The directive, however, takes an optional second argument which specifies the name of the file to fetch. (Though "par_base" does not fetch files itself, see below.) par_base 'SMUELLER', 'foo'; Once "fetch_par" is called, the file 'foo' will be downloaded from SMUELLER's CPAN directory. (It doesn't exist.) The second argument could be used to fetch platform-agnostic binaries: par_base 'SMUELLER', "Some-Distribution-0.01.par"; (Documentation TODO: Use the previously defined distribution name and version in example.) fetch_par Fetches the .par file previously referenced in the documentation of the "par_base" directive. "fetch_par" can be used without arguments given the "par_base" directive was used before. It will return the name of the file it fetched. If the first argument is an URL or a CPAN user ID, the file is fetched from that directory unless an URL has been previously set. (Read that again.) If the second argument is a file name it is used as the name of the file to download. If the file could not be fetched, a suitable error message about no package being available, yada yada yada, is printed. You can turn this off by specifying a true third argument. # Try to fetch the package (see par_base) but # don't be verbose about failures my $file = fetch_par('', '', undef); extract_par Takes the name of a PAR::Dist archive file as first argument. The 'blib/' directory of this archive is extracted and the 'pm_to_blib' is created. Typical shorthand usage: extract_par( fetch_par ) or die "Could not install PAR::Dist archive."; make_par This directive requires PAR::Dist (version 0.03 or up) on your system. (And checks that it is available before continuing.) Creates a PAR::Dist archive from the 'blib/' subdirectory. First argument must be the name of the PAR::Dist archive to create. If your Makefile.PL has a "par_base" directive, the "make par" make target will be available. It uses this "make_par" directive internally, so on your development system, you can do this to create a .par binary archive for your platform: perl Makefile.PL make make par AUTHOR
Audrey Tang <cpan@audreyt.org> With documentation from Steffen Mueller <smueller@cpan.org> COPYRIGHT
Copyright (c) 2006. Audrey Tang. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.14.2 2012-03-01 Module::Install::PAR(3pm)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy