Search string and print the above line and below lines?.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search string and print the above line and below lines?.
# 8  
Old 11-27-2012
Command above can be written:
Code:
awk '/Record|TranTime|TranID|Balance|Account/' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String search and print next all lines in one line until blank line

Dear all I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under. i/p file: A1/EXT "BSCABD1_21233G1" 757 130823 1157 RADIO X-CEIVER ADMINISTRATION BTS EXTERNAL FAULT ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

2. Shell Programming and Scripting

Search words in a line and print next 15 lines.

I have a text file ( basically a log file) and i have 2 words (alpha, beta), Now i want to search these two words in one line and then print next 15 lines in a temp file. there would be many lines with alpha and beta But I need only last occurrence with "alpha" and "beta" and next 15 lines. ... (4 Replies)
Discussion started by: kashif.live
4 Replies

3. Shell Programming and Scripting

Search for string and print top and bottom line

Hi Folks I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below. example: The ball is green and blue Billy through the ball higer. Jane got hurt with the ball. So if I search for Billy I would need the 3... (1 Reply)
Discussion started by: bombcan
1 Replies

4. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

5. Shell Programming and Scripting

Print #of lines after search string in a big file

I have a command which prints #lines after and before the search string in the huge file nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r;print;c=a}b{r=$0}' b=0 a=10 s="STRING1" FILE The file is 5 gig big. It works great and prints 10 lines after the lines which contains search string in... (8 Replies)
Discussion started by: prash184u
8 Replies

6. Shell Programming and Scripting

Print lines after the search string until blank line is found

All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line. Log EXAMPLE : MT:Exception caught The following Numbers were affected: 1234 2345 2346 Error java.lang.InternalError:... (3 Replies)
Discussion started by: prash184u
3 Replies

7. Shell Programming and Scripting

awk print second line after search string

I have multiple config files where I need to pull the ip address from loopback3. The format is the same in every file, the ip is the second line after interface loopback3. interface loopback2 loopback description router ID ip address 192.168.1.1 interface loopback3 loopback description... (3 Replies)
Discussion started by: numele
3 Replies

8. Shell Programming and Scripting

Search a string and print the rest of line

Hi Guys, I need to search a string and print the rest of the lines... input: 8 0 90 1 0 59 20 2488 96 30006dde372 S ? 0:00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n output: 00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n Actually i don even need the first "00".. any suggestions is appreciated..... (13 Replies)
Discussion started by: mac4rfree
13 Replies

9. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

Hello, Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line. i am using string as "testing" netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h i am able to get the previous line current line next line but... (1 Reply)
Discussion started by: nmadhuhb
1 Replies

10. Shell Programming and Scripting

Print lines with search string at specific position

Hi Folks, I have a file with all fields defined by byte position, but any field can be empty so I cannot print lines based on a search of specific columns. I need to print all lines of this file where the string of two characters at byte position 100-101 contains the number 27. Any ideas? ... (4 Replies)
Discussion started by: HealthyGuy
4 Replies
Login or Register to Ask a Question
Gtk2::SourceView2::PrintCompositor(3pm) 		User Contributed Perl Documentation		   Gtk2::SourceView2::PrintCompositor(3pm)

NAME
Gtk2::SourceView2::PrintCompositor HIERARCHY
Glib::Object +----Gtk2::SourceView2::PrintCompositor METHODS
printcompositor = Gtk2::SourceView2::PrintCompositor->new ($buffer) o $buffer (Gtk2::SourceView2::Buffer) printcompositor = Gtk2::SourceView2::PrintCompositor->new_from_view ($view) o $view (Gtk2::SourceView2::View) string = $compositor->get_body_font_name $compositor->set_body_font_name ($font_name) o $font_name (string) double = $compositor->get_bottom_margin ($unit) o $unit (Gtk2::Unit) $compositor->set_bottom_margin ($margin, $unit) o $margin (double) o $unit (Gtk2::Unit) buffer = $compositor->get_buffer $compositor->draw_page ($context, $page_nr) o $context (Gtk2::PrintContext) o $page_nr (integer) string = $compositor->get_footer_font_name $compositor->set_footer_font_name ($font_name) o $font_name (string or undef) $compositor->set_footer_format ($separator, $left, $center, $right) o $separator (boolean) o $left (string or undef) o $center (string or undef) o $right (string or undef) string = $compositor->get_header_font_name $compositor->set_header_font_name ($font_name) o $font_name (string or undef) $compositor->set_header_format ($separator, $left, $center, $right) o $separator (boolean) o $left (string or undef) o $center (string or undef) o $right (string or undef) boolean = $compositor->get_highlight_syntax $compositor->set_highlight_syntax ($highlight) o $highlight (boolean) double = $compositor->get_left_margin ($unit) o $unit (Gtk2::Unit) $compositor->set_left_margin ($margin, $unit) o $margin (double) o $unit (Gtk2::Unit) string = $compositor->get_line_numbers_font_name $compositor->set_line_numbers_font_name ($font_name) o $font_name (string or undef) integer = $compositor->get_n_pages boolean = $compositor->paginate ($context) o $context (Gtk2::PrintContext) double = $compositor->get_pagination_progress boolean = $compositor->get_print_footer $compositor->set_print_footer ($print) o $print (boolean) boolean = $compositor->get_print_header $compositor->set_print_header ($print) o $print (boolean) integer = $compositor->get_print_line_numbers $compositor->set_print_line_numbers ($interval) o $interval (integer) double = $compositor->get_right_margin ($unit) o $unit (Gtk2::Unit) $compositor->set_right_margin ($margin, $unit) o $margin (double) o $unit (Gtk2::Unit) integer = $compositor->get_tab_width $compositor->set_tab_width ($width) o $width (integer) double = $compositor->get_top_margin ($unit) o $unit (Gtk2::Unit) $compositor->set_top_margin ($margin, $unit) o $margin (double) o $unit (Gtk2::Unit) wrapmode = $compositor->get_wrap_mode $compositor->set_wrap_mode ($wrap_mode) o $wrap_mode (Gtk2::WrapMode) PROPERTIES
'body-font-name' (string : default undef : readable / writable) Name of the font to use for the text body (e.g. "Monospace 10") 'buffer' (Gtk2::SourceView2::Buffer : default undef : readable / writable / construct-only) The GtkSourceBuffer object to print 'footer-font-name' (string : default undef : readable / writable) Name of the font to use for the page footer (e.g. "Monospace 10") 'header-font-name' (string : default undef : readable / writable) Name of the font to use for the page header (e.g. "Monospace 10") 'highlight-syntax' (boolean : default true : readable / writable) Whether to print the document with highlighted syntax 'line-numbers-font-name' (string : default undef : readable / writable) Name of the font to use for the line numbers (e.g. "Monospace 10") 'n-pages' (integer : default -1 : readable) The number of pages in the document (-1 means the document has not been completely paginated). 'print-footer' (boolean : default false : readable / writable) Whether to print a footer in each page 'print-header' (boolean : default false : readable / writable) Whether to print a header in each page 'print-line-numbers' (Glib::UInt : default 1 : readable / writable) Interval of printed line numbers (0 means no numbers) 'tab-width' (Glib::UInt : default 8 : readable / writable) Width of a tab character expressed in spaces 'wrap-mode' (Gtk2::WrapMode : default "none" : readable / writable) Whether to wrap lines never, at word boundaries, or at character boundaries. ENUMS AND FLAGS
enum Gtk2::Unit o 'pixel' / 'GTK_UNIT_PIXEL' o 'points' / 'GTK_UNIT_POINTS' o 'inch' / 'GTK_UNIT_INCH' o 'mm' / 'GTK_UNIT_MM' enum Gtk2::WrapMode o 'none' / 'GTK_WRAP_NONE' o 'char' / 'GTK_WRAP_CHAR' o 'word' / 'GTK_WRAP_WORD' o 'word-char' / 'GTK_WRAP_WORD_CHAR' SEE ALSO
Gtk2::SourceView2, Glib::Object COPYRIGHT
Copyright (C) 2009 by Emmanuel Rodriguez perl v5.14.2 2011-11-16 Gtk2::SourceView2::PrintCompositor(3pm)