Sponsored Content
Top Forums Shell Programming and Scripting Easy way to pull a paragraph from a text file? Post 302492250 by bigbot on Sunday 30th of January 2011 05:01:35 PM
Old 01-30-2011
If you want context around the line use the -A, -B, or -C options. For instance:

Code:
grep "string" /path_to_directory/ -C50

This will give you 50 lines of context around the line matched. Also, I like to use the --color=always option which gives me the lined matched in color red for easy identification.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. Shell Programming and Scripting

extracting last paragraph from a text

Hi All, I want to extract last paragraph from a text for example aaaaa sadafsa sdfdsaf asfdsad asfdsfad asfdfsafd adfssas asdfsafdsa asfdasdfa sadfasdsaf i need the last paragraph how to do it using linux commands (1 Reply)
Discussion started by: uvrakesh
1 Replies

3. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

4. Shell Programming and Scripting

convert text contents/paragraph to cvs

hi all, iam new to awk & sed cmd and appreacite help from all the script expert from this forum, i have a file like below: Fri Aug 01 00:01:19 2008 NAS-IP-Address = 172.16.160.1 Class = "P1-SHT-AAA01;1217116976;70999" Calling-Station-Id = "00-11-FB-01-03-06" Acct-Status-Type = Start... (13 Replies)
Discussion started by: xajax7
13 Replies

5. Shell Programming and Scripting

Pull specific data from repetitive text?

Hi all, I have a bit of a problem with a loop that extracts repetitive text. Running /bin/index executable outputs this text to terminal: testing index 'scanthread'... collected 0 docs, 0.0 MB total 0 docs, 0 bytes total 0.012 sec, 0 bytes/sec, 0.00 docs/sec testing index 'scanpost'...... (6 Replies)
Discussion started by: TECK
6 Replies

6. Shell Programming and Scripting

Search for a particular string in a paragraph in a text

Hi all, i'm new to this community. I am trying to write a script which will fetch ftp completion time of a file from a paragraph of a big text file ( which contains multiple paragraphs) . Each paragraph will have ftp details.. Now I dont know how to fetch process time within a paragraph of... (3 Replies)
Discussion started by: prachiagra
3 Replies

7. Shell Programming and Scripting

grabbing filename from text file....should be easy!

Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies

8. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

9. Shell Programming and Scripting

Script to pull hashes out of large text file

I am attempting to write a script that will pull out NTLM hashes from a text file that contains about 500,000 lines of data. Not all accounts contain hashes and I only need the ones that do contain hashes. Here is a sample of what the data looks like: There are thousands of other lines in... (6 Replies)
Discussion started by: chango77747
6 Replies

10. Shell Programming and Scripting

Print each paragraph in a text file into excel file

Hi, I have a below text file, which needs to be printed into attached excel file. Please help me. Thanks (4 Replies)
Discussion started by: prash358
4 Replies
Text::Flow::Wrap(3pm)					User Contributed Perl Documentation				     Text::Flow::Wrap(3pm)

NAME
Text::Flow::Wrap - Flexible word wrapping for not just ASCII output. SYNOPSIS
use Text::Flow::Wrap; # for regular ASCII usage ... my $wrapper = Text::Flow::Wrap->new( check_width => sub { length($_[0]) < 70 }, ); # for non-ASCII usage ... my $wrapper = Text::Flow::Wrap->new( check_width => sub { $pdf->get_text_width($_[0]) < 500 }, ); my $text = $wrapper->wrap($text); DESCRIPTION
The main purpose of this module is to provide text wrapping features without being tied down to ASCII based output and fixed-width fonts. My needs were for sophisticated test control in PDF and GIF output formats in particular. METHODS
new (%params) This constructs a new Text::Flow::Wrap module whose %params set the values of the attributes listed below. wrap ($text) This method will accept a bunch of text, it will then return a new string which is wrapped to the expected width. Attribute Accessors check_width (&code) This attribute is required, and must be a CODE reference. This will be used to determine if the width of the text is appropriate. It will get as an argument, a string which is should check the width of. It should return a Boolean value, true if the string is not exceeded the max width and false if it has. line_break ($str) This is the line break character used when assembling and disassembling the text, it defaults to the newline character " ". paragraph_boundry ($str) This is the paragraph boundry marker used when disassembling the text, it defaults to the string " ". paragraph_break ($str) This is the paragraph breaker used when re-assembling the text, it defaults to the string " ". word_boundry ($str) This is the word boundry marker used when disassembling the text, it defaults to a single space character. word_break ($str) This is the paragraph breaker used when re-assembling the text, it defaults to a single space character. Paragraph Disassembling These methods deal with breaking up the paragraphs into its parts, which can then be processed through the re-assembling methods. These methods are mostly used internally, but more sophisticated tools might need to access them as well (see Text::Flow). disassemble_paragraph disassemble_paragraphs Paragraph Reassembling These methods deal with putting the paragraph parts back together after the disassembling methods have done thier work. These methods are mostly used internally, but more sophisticated tools might need to access them as well (see Text::Flow) reassemble_paragraph reassemble_paragraphs Introspection meta Returns the Moose meta object associated with this class. BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. AUTHOR
Stevan Little <stevan@iinteractive.com> COPYRIGHT AND LICENSE
Copyright 2007 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2007-05-21 Text::Flow::Wrap(3pm)
All times are GMT -4. The time now is 04:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy