I could not tell if only the 2 lines matching 2 patterns were desired, or if the entire section between those two lines was wanted. So here is a solution for both, using easily accessible grep-like utilities:
exit 0
producing:
peg: http://www.cpan.org/authors/id/A/AD/ADAVIES/peg-3.14
Both codes have many more features than noted here. Regarding peg, because it is in perl, it can be taken to almost any platform that has perl. The cgrep code is c, which means that it must be compiled. I had no trouble compiling it on 32-bit and 64-bit systems with gcc.
Hi All,
OS-Type=Sun-OS 5.8 Sparc9 Processor
Can I grep the previous 4 lines and next 4 lines of a matched pattern(context grep)?
For example here we need to monitor logs of live traffic.The data obtained from "tail -f LiveTrafficData.log"
looks something like this:-... (3 Replies)
OK. I have a file I'd like to be able to grep, but on top of returning the line where the pattern matches, I'd like to be able to get the previous 8 lines and the following 8 lines. Is there a way to do this? (2 Replies)
Hi all,
I am looking for a quick solution for this:
I have many log files of an iterative program, and I would like to display the parameters of the last three iteration from each of those files. Relevant lines have the keyword: ITER
I am using:
tac ~/modeling*/fitting.log | grep -m 3 -e... (2 Replies)
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)
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)
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)
Hi all,
I am struck with the below requirement. I need to grep a particular pattern in a file and then print next n lines of it for further processing.
I have used the below code
grep -A 3 "pattern" filename
But it is throwing error as below.
grep: illegal option -- A
Can... (14 Replies)
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)
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)
Linux version : Oracle Linux 6.5
Shell : bash
In the the below text file (someString.text), I want to grep all lines with .sh in it. ie. Only the lines mysript.sh and anotherscript.sh should be returned.
My below attempts failed.
I gather that in regular expression world, dot (.) is the... (3 Replies)
Discussion started by: John K
3 Replies
LEARN ABOUT OSX
page_util_peg
page_util_peg(n) Parser generator tools page_util_peg(n)
__________________________________________________________________________________________________________________________________________________NAME
page_util_peg - page PEG transformation utilities
SYNOPSIS
package require page::util::peg ?0.1?
package require snit
::page::util::peg::symbolNodeOf tree node
::page::util::peg::symbolOf tree node
::page::util::peg::updateUndefinedDueRemoval tree
::page::util::peg::flatten treequery tree
::page::util::peg::getWarnings tree
::page::util::peg::printWarnings msg
::page::util::peg::peOf tree eroot
::page::util::peg::printTclExpr pe
_________________________________________________________________DESCRIPTION
This package provides a few common operations to PEG transformations. They assume a Normalized PE Grammar Tree as input, see the package
page::util::norm::peg, possibly augmented with attributes coming from transformations not in conflict with the base definition.
API
::page::util::peg::symbolNodeOf tree node
Given an arbitrary expression node in the AST tree it determines the node (itself or an ancestor) containing the name of the nonter-
minal symbol the node belongs to, and returns its id. The result is either the root of the tree (for the start expression), or a
definition node.
::page::util::peg::symbolOf tree node
As ::page::util::peg::symbolNodeOf, but returns the symbol name instead of the node.
::page::util::peg::updateUndefinedDueRemoval tree
The removal of nodes in the AST tree can cause symbols to lose one or more users.
A used by B and C,
B is reachable,
C is not,
so A now loses the node in the expression for C calling it,
or rather, not calling it anymore.
This command updates the cross-references and which nonterminals are now undefined.
::page::util::peg::flatten treequery tree
This commands flattens nested sequence and choice operators in the AST tree, re-using the treeql object treequery to run the query
determining which nodes to cut.
::page::util::peg::getWarnings tree
This command looks at the attributes of the AST tree for problems with the grammar and issues warnings. They do not prevent us from
writing the grammar, but still represent problems with it the user should be made aware of.
The result of the command is a dictionary mapping nonterminal names to their associated warnings.
::page::util::peg::printWarnings msg
The argument of the command is a dictionary mapping nonterminal names to their associated warnings, as generated by, for example,
the command ::page::util::peg::getWarnings.
The warnings contained therein are formatted and then printed via the log command page_info. This means that this command can be
used only from within a plugin managed by the package page::pluginmgr.
::page::util::peg::peOf tree eroot
This command converts the parsing expression starting at the node eroot in the AST tree into a nested list. The exact syntax of this
list specified by the package grammar::peg.
::page::util::peg::printTclExpr pe
This command converts the parsing expression contained in the nested list pe into a Tcl string which can be placed into a Tcl
script. See the package grammar::peg for the exact syntax of pe.
BUGS, IDEAS, FEEDBACK
This document, will undoubtedly contain bugs and other problems. Please report such in the category page of the Tcllib SF Trackers
[http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have.
KEYWORDS
PEG, page, parser generator, parsing expression grammar, text processing, transformation
CATEGORY
Page Parser Generator
COPYRIGHT
Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>
page 1.0 page_util_peg(n)