Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search for string between specific lines of code in vi Post 302334547 by coolavi on Thursday 16th of July 2009 12:50:39 AM
Old 07-16-2009
My bad!

Yogesh, it works like a charm. I mis-interpreted the alphabet 'l' (lower case L as in long) as 1.
nj78, thanks for pointing out the mistake.


Also, can one of you guys interpret this, as to how you were able to work it out? I think learning and understanding the concept is the more important than just getting the result.

Thanks,
coolavi
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

Search a specific string

Hi, I have following requirement. Pls suggest. To search a string in a file which is combination of character and number(always 9 digit, but numeric). if found then caputure the exit return code as 0 else 1 , if 0 then next job can be triggerd. If exit code is 1, should return a failure... (10 Replies)
Discussion started by: zooby
10 Replies

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

4. Shell Programming and Scripting

substitute a string on a specific position for specific lines

I woud like to substitue a string on a specific position for specific lines I've got a file and I would like to change a specific string from "TOCHANGE" to "ABCABCAB" For every line (except 1,2, 3 and the last one) , I need to check between the 9th and the 16th digits. For the 3rd line, I... (7 Replies)
Discussion started by: BSF
7 Replies

5. Shell Programming and Scripting

Awk - find string, search lines below string for other strings

What's the easiest way to search a file for a specific string and then look for other instances after that? I want to search for all Virtual Hosts and print out the Server Name and Document Root (if it has that info), while discarding the rest of the info. Basically my file looks like this: ...... (6 Replies)
Discussion started by: Mbohmer
6 Replies

6. Shell Programming and Scripting

Printing all lines before a specific string and a custom message 2 lines after

Hello all, I need to print all the lines before a specific string and print a custom message 2 lines after that. So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message. My code thus far is:... (4 Replies)
Discussion started by: SEinT
4 Replies

7. UNIX for Dummies Questions & Answers

Search for a specific String in a log file for a specific date range

Hi, I have log file which rolls out every second which is as this. HttpGenRequest - -<!--OXi dbPublish--> <created="2014-03-24 23:45:37" lastMsgId="" requestTime="0.0333"> <response request="getOutcomeDetails" code="114" message="Request found no matching data" debug="" provider="undefined"/>... (3 Replies)
Discussion started by: karthikprakash
3 Replies

8. UNIX for Dummies Questions & Answers

Search specific string logfile specific date range

Hi, I have logfile like this.. === 2014-02-09 15:46:59,936 INFO RequestContext - URL: '/eyisp/sc/skins/EY/images/pickers/comboBoxPicker_Over.png', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header === 2015-02-09... (8 Replies)
Discussion started by: kishk
8 Replies

9. Shell Programming and Scripting

Search and replace specific positions of specific lines

Hi, I have a file with hundreds of lines. I want to search for particular lines starting with 4000, search and replace the 137-139 position characters; which will be '000', with '036'. Can all of this be done without opening a temp file and then moving that temp file to the original file name. ... (7 Replies)
Discussion started by: dsid
7 Replies

10. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
pt::pe::op(n)							   Parser Tools 						     pt::pe::op(n)

__________________________________________________________________________________________________________________________________________________

NAME
pt::pe::op - Parsing Expression Utilities SYNOPSIS
package require Tcl 8.5 package require pt::pe::op ?1? package require pt::pe ?1? package require struct::set ::pt::pe::op drop dropset pe ::pt::pe::op rename nt ntnew pe ::pt::pe::op called pe ::pt::pe::op flatten pe ::pt::pe::op fusechars pe _________________________________________________________________ DESCRIPTION
Are you lost ? Do you have trouble understanding this document ? In that case please read the overview provided by the Introduction to Parser Tools. This document is the entrypoint to the whole system the current package is a part of. This package provides additional commands to work with the serializations of parsing expressions as managed by the PEG and related pack- ages, and specified in section PE serialization format. This is an internal package, for use by the higher level packages handling PEGs, their conversion into and out of various other formats, or other uses. API
::pt::pe::op drop dropset pe This command removes all occurences of any of the nonterminals symbols in the set dropset from the parsing expression pe, and sim- plifies it. This may result in the expression becoming "epsilon", i.e. matching nothing. ::pt::pe::op rename nt ntnew pe This command renames all occurences of the nonterminal nt in the parsing expression pe into ntnew. ::pt::pe::op called pe This command extracts the set of all nonterminal symbols used, i.e. 'called', in the parsing expression pe. ::pt::pe::op flatten pe This command transforms the parsing expression by eliminating sequences nested in sequences, and choices in choices, lifting the children of the nested expression into the parent. It further eliminates all sequences and choices with only one child, as these are redundant. The resulting parsing expression is returned as the result of the command. ::pt::pe::op fusechars pe This command transforms the parsing expression by fusing adjacent terminals in sequences and adjacent terminals and ranges in choices, it (re)constructs highlevel strings and character classes. The resulting pseudo-parsing expression is returned as the result of the command and may contain the pseudo-operators str for char- acter sequences, aka strings, and cl for character choices, aka character classes. The result is called a pseudo-parsing expression because it is not a true parsing expression anymore, and will fail a check with ::pt::peg verify if the new pseudo-operators are present in the result, but is otherwise of sound structure for a parsing expres- sion. Notably, the commands ::pt::peg bottomup and ::pt::peg topdown will process them without trouble. PE SERIALIZATION FORMAT
Here we specify the format used by the Parser Tools to serialize Parsing Expressions as immutable values for transport, comparison, etc. We distinguish between regular and canonical serializations. While a parsing expression may have more than one regular serialization only exactly one of them will be canonical. Regular serialization Atomic Parsing Expressions [1] The string epsilon is an atomic parsing expression. It matches the empty string. [2] The string dot is an atomic parsing expression. It matches any character. [3] The string alnum is an atomic parsing expression. It matches any Unicode alphabet or digit character. This is a custom extension of PEs based on Tcl's builtin command string is. [4] The string alpha is an atomic parsing expression. It matches any Unicode alphabet character. This is a custom exten- sion of PEs based on Tcl's builtin command string is. [5] The string ascii is an atomic parsing expression. It matches any Unicode character below U0080. This is a custom extension of PEs based on Tcl's builtin command string is. [6] The string control is an atomic parsing expression. It matches any Unicode control character. This is a custom exten- sion of PEs based on Tcl's builtin command string is. [7] The string digit is an atomic parsing expression. It matches any Unicode digit character. Note that this includes characters outside of the [0..9] range. This is a custom extension of PEs based on Tcl's builtin command string is. [8] The string graph is an atomic parsing expression. It matches any Unicode printing character, except for space. This is a custom extension of PEs based on Tcl's builtin command string is. [9] The string lower is an atomic parsing expression. It matches any Unicode lower-case alphabet character. This is a cus- tom extension of PEs based on Tcl's builtin command string is. [10] The string print is an atomic parsing expression. It matches any Unicode printing character, including space. This is a custom extension of PEs based on Tcl's builtin command string is. [11] The string punct is an atomic parsing expression. It matches any Unicode punctuation character. This is a custom extension of PEs based on Tcl's builtin command string is. [12] The string space is an atomic parsing expression. It matches any Unicode space character. This is a custom extension of PEs based on Tcl's builtin command string is. [13] The string upper is an atomic parsing expression. It matches any Unicode upper-case alphabet character. This is a cus- tom extension of PEs based on Tcl's builtin command string is. [14] The string wordchar is an atomic parsing expression. It matches any Unicode word character. This is any alphanumeric character (see alnum), and any connector punctuation characters (e.g. underscore). This is a custom extension of PEs based on Tcl's builtin command string is. [15] The string xdigit is an atomic parsing expression. It matches any hexadecimal digit character. This is a custom exten- sion of PEs based on Tcl's builtin command string is. [16] The string ddigit is an atomic parsing expression. It matches any decimal digit character. This is a custom extension of PEs based on Tcl's builtin command regexp. [17] The expression [list t x] is an atomic parsing expression. It matches the terminal string x. [18] The expression [list n A] is an atomic parsing expression. It matches the nonterminal A. Combined Parsing Expressions [1] For parsing expressions e1, e2, ... the result of [list / e1 e2 ... ] is a parsing expression as well. This is the ordered choice, aka prioritized choice. [2] For parsing expressions e1, e2, ... the result of [list x e1 e2 ... ] is a parsing expression as well. This is the sequence. [3] For a parsing expression e the result of [list * e] is a parsing expression as well. This is the kleene closure, describing zero or more repetitions. [4] For a parsing expression e the result of [list + e] is a parsing expression as well. This is the positive kleene clo- sure, describing one or more repetitions. [5] For a parsing expression e the result of [list & e] is a parsing expression as well. This is the and lookahead predi- cate. [6] For a parsing expression e the result of [list ! e] is a parsing expression as well. This is the not lookahead predi- cate. [7] For a parsing expression e the result of [list ? e] is a parsing expression as well. This is the optional input. Canonical serialization The canonical serialization of a parsing expression has the format as specified in the previous item, and then additionally satis- fies the constraints below, which make it unique among all the possible serializations of this parsing expression. [1] The string representation of the value is the canonical representation of a pure Tcl list. I.e. it does not contain superflu- ous whitespace. [2] Terminals are not encoded as ranges (where start and end of the range are identical). EXAMPLE Assuming the parsing expression shown on the right-hand side of the rule Expression <- '(' Expression ')' / Factor (MulOp Factor)* then its canonical serialization (except for whitespace) is {/ {x {t (} {n Expression} {t )}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}} BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category pt of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
EBNF, LL(k), PEG, TDPL, context-free languages, expression, grammar, matching, parser, parsing expression, parsing expression grammar, push down automaton, recursive descent, state, top-down parsing languages, transducer CATEGORY
Parsing and Grammars COPYRIGHT
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net> pt 1 pt::pe::op(n)
All times are GMT -4. The time now is 07:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy