Dear friends, Please help me to resolve the problem below,
I have a file with following content:
date of file creation : 12 feb 2007
====================
= name : suresh
= city :mumbai
#this is a blank line
= date : 1st Nov 2005
====================
few lines of some text
this... (7 Replies)
I am parsing a nagios config, searching for a string, and then printing the line 2 lines later (the "members" string). Here's the data:
define hostgroup{
hostgroup_name chat-dev
alias chat-dev
members thisisahostname
}
define hostgroup{
... (1 Reply)
file1:
file2:
I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading):
This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
Data:
Pattern Data Data Data
Data Data Data
Data Data Data
...
With awk, how do I print the pattern matching line, then the subsequent lines following the pattern matching line. Varying number of lines following the pattern matching line. (9 Replies)
Hi All,
I have following listing
Filesystem GB blocks Free Used Iused Iused Mounted on
/dev/hd2 4.00 0.31 93 63080 43 /usr
Filesystem GB blocks Free Used Iused Iused Mounted on
Filesystem GB blocks Free Used Iused Iused... (11 Replies)
Hi,
I have a file like below.
1,2,3,4,5,6,7,8,9I would like to print or copied to a file based of line count in perl
If I gave a condition 1 to 3 then it should iterate over above file and print 1 to 3 and then again 1 to 3 etc.
output should be
1,2,3
4,5,6
7,8,9 (10 Replies)
I need to fetch particular string from log file based on grep condition match.
Actual requirement is need to print the next word from the same line based on grep string condtion match.
File :Java.lanag.xyz......File copied completed : abc.txt
Ouput :abc.txt
I have used below... (5 Replies)
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
Hi, I am trying to do something like this ...
I use awk to match a pattern, and then print out all col.
My code is :
awk '{if ($1 ==300) print $1,$2-'$sbin7',$3}' tmp.txt
output=
300 2
whereby sbin7=2,
The thing is, I want to print all col and row, not just the matched line/row only, but... (10 Replies)
Hi All,
I have problem in the middle of implementing to users, whereby the complaint is all about the decimal place which is too long. I need two decimal places only, but the outcome from command is always fixed to 6.
See the sample :
before:
Sort Total
Site Sort SortName Parts ... (3 Replies)
Discussion started by: horsepower
3 Replies
LEARN ABOUT DEBIAN
text::context
Text::Context(3pm) User Contributed Perl Documentation Text::Context(3pm)NAME
Text::Context - Handle highlighting search result context snippets
SYNOPSIS
use Text::Context;
my $snippet = Text::Context->new($text, @keywords);
$snippet->keywords("foo", "bar"); # In case you change your mind
print $snippet->as_html;
print $snippet->as_text;
DESCRIPTION
Given a piece of text and some search terms, produces an object which locates the search terms in the message, extracts a reasonable-length
string containing all the search terms, and optionally dumps the string out as HTML text with the search terms highlighted in bold.
new
Creates a new snippet object for holding and formatting context for search terms.
keywords
Accessor method to get/set keywords. As the context search is done case-insensitively, the keywords will be lower-cased.
paras
@paras = $self->paras($maxlen)
Return shortened paragraphs to fit together into a snippet of at most $maxlen characters.
as_text
Calculates a "representative" string which contains the given search terms. If there's lots and lots of context between the terms, it's
replaced with an ellipsis.
as_html([ start => "<some tag>", end => "<some end tag>" ])
Markup the snippet as a HTML string using the specified delimiters or with a default set of delimiters ("<span class="quoted">").
AUTHOR
Original author: Simon Cozens
Current maintainer: Tony Bowden
BUGS and QUERIES
Please direct all correspondence regarding this module to:
bug-Text-Context@rt.cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2002-2005 Kasei
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License; either version
2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
perl v5.10.1 2009-07-23 Text::Context(3pm)