Sponsored Content
Top Forums Shell Programming and Scripting Want to grep for a pattern and display the content above that pattern Post 302432376 by ajayakunuri on Friday 25th of June 2010 12:56:09 AM
Old 06-25-2010
Hi,
Thanks for your replies, but they dint work Smilie

@panyam: It is displaying all the lines before that. i did a wc -l and here is the output
[cmg-iqdps2p0] x772525 /usr/prod/bdw/log> awk 'c&&c--;/FAILED/{c=50;print p;exit}{p=p"\n"$0}' dm_distwatch10r.20100624.log|wc -l
621

@jim mcnamara: It is throwing an error
ksh: start=-50[[: This is not an identifier.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

display content between all similar tags pattern

hi, I m stuck at a point for more than 3days. My doubt is pretty simple.. I have a web page content in $content. ( got this by using LWP).. Now I want to display the content matching a pattern. I tried if($content =~ m{<div class="abc">(.*?)</div>}s){ print $1;} that will... (4 Replies)
Discussion started by: therockravi
4 Replies

2. Shell Programming and Scripting

Grep pattern from different file and display if it exists in the required file

Hi, I have two files say xxx.txt and yyy.txt. xxx.txt is with list of patterns within double quotes. Eg. "this is the line1" "this is the line2" The yyy.txt with lot of lines. eg: "This is a test message which contains rubbish information just to fill the page which is of no use. this is... (3 Replies)
Discussion started by: abinash
3 Replies

3. Shell Programming and Scripting

Grep a pattern given in one file at other file and display its corresponding contents as output.

***************************************** Right now i have this current system. I have two files say xxx.txt and yyy.txt. xxx.txt is with list of patterns within double quotes. Eg. "this is the line1" "this is the line2" The yyy.txt with lot of lines. eg: "This is a test message which... (7 Replies)
Discussion started by: abinash
7 Replies

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

5. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

6. Shell Programming and Scripting

Grep pattern and display all lines below

Hi I need to grep for a patter and display all lines below the pattern. For ex: say my file has the below lines file1 file2 file3 file4 file5 I NEED to grep for patter file3 and display all lines below the pattern. do we have an option to get this data. Let me know if you require... (5 Replies)
Discussion started by: venkidhadha
5 Replies

7. Shell Programming and Scripting

Grep lines before a pattern having some other pattern

Hi All, I am trying to fetch lines before a pattern, I got to know about -B flag in grep but we have to pass the number to get those lines before some pattern say (X), now what if I want to get line/s with some other pattern say (Y) before X pattern? How to get about it? please help. Input:... (5 Replies)
Discussion started by: dips_ag
5 Replies

8. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
PS_BEGIN_PATTERN(3)							 1						       PS_BEGIN_PATTERN(3)

ps_begin_pattern - Start a new pattern

SYNOPSIS
int ps_begin_pattern (resource $psdoc, float $width, float $height, float $xstep, float $ystep, int $painttype) DESCRIPTION
Starts a new pattern. A pattern is like a page containing e.g. a drawing which can be used for filling areas. It is used like a color by calling ps_setcolor(3) and setting the color space to pattern. PARAMETERS
o $psdoc - Resource identifier of the postscript file as returned by ps_new(3). o $width - The width of the pattern in pixel. o $height - The height of the pattern in pixel. o $x-step - The distance in pixel of placements of the pattern in horizontal direction. o $y-step - The distance in pixel of placements of the pattern in vertical direction. o $painttype - Must be 1 or 2. RETURN VALUES
The identifier of the pattern or FALSE on failure. EXAMPLES
Example #1 Creating and using a pattern <?php $ps = ps_new(); if (!ps_open_file($ps, "pattern.ps")) { print "Cannot open PostScript file "; exit; } ps_set_parameter($ps, "warning", "true"); ps_set_info($ps, "Creator", "pattern.php"); ps_set_info($ps, "Author", "Uwe Steinmann"); ps_set_info($ps, "Title", "Pattern example"); $pspattern = ps_begin_pattern($ps, 10.0, 10.0, 10.0, 10.0, 1); ps_setlinewidth($ps, 0.2); ps_setcolor($ps, "stroke", "rgb", 0.0, 0.0, 1.0, 0.0); ps_moveto($ps, 0, 0); ps_lineto($ps, 7, 7); ps_stroke($ps); ps_moveto($ps, 0, 7); ps_lineto($ps, 7, 0); ps_stroke($ps); ps_end_pattern($ps); ps_begin_page($ps, 596, 842); ps_setcolor($ps, "both", "pattern", $pspattern, 0.0, 0.0, 0.0); ps_rect($ps, 50, 400, 200, 200); ps_fill($ps); ps_end_page($ps); ps_close($ps); ps_delete($ps); ?> SEE ALSO
ps_end_pattern(3), ps_setcolor(3), ps_shading_pattern(3). PHP Documentation Group PS_BEGIN_PATTERN(3)
All times are GMT -4. The time now is 09:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy