09-21-2015
sed '/^hello my name is /s/[^ ]*$/irrelevant now/g' myFile
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Need to extract a string from one file and search the same in other files.
Ex:
I have file1 of hundred lines with no delimiters not even space.
I have 3 more files.
I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
Discussion started by: mohancrr
1 Replies
2. UNIX for Dummies Questions & Answers
I need to search for a specific string in a file and if this string exist I need to replace it with something else. I am not sure how I could do this, using an if statement. (2 Replies)
Discussion started by: ROOZ
2 Replies
3. Shell Programming and Scripting
Hi people. I am new to shell scripting, so I need a little help. I want to create a script named that takes an argument as a file, Read the input file and look for occurrences of the current username (say abc.xyz) who is executing the script. On finding an occurrence of the username take that line... (2 Replies)
Discussion started by: kartikkumar84@g
2 Replies
4. Shell Programming and Scripting
Hi,
I am new to unix shell scripting.
I have a requirement.
Could anyone help me writing the script for the same?
Here goes the requirement:
I have a config file let's say temp.config.
Here is the data in the config file
temp.config :
-------------
name=victor
age=42
state=texas... (5 Replies)
Discussion started by: badrimohanty
5 Replies
5. Shell Programming and Scripting
Hi Guys...
I want to search for each file that contains a particular string.
e.g find . -print | xargs grep -i string_name
Now my issue is the files that I search in are gzipped.
Will I be able to find the string, using the above commands, even if the files are gzipped?
Please... (2 Replies)
Discussion started by: Phuti
2 Replies
6. Shell Programming and Scripting
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Discussion started by: dazhoop
2 Replies
7. Shell Programming and Scripting
Hi,
I have a requirement where I need to replace a string in a line and this line will be identified by search criteria on previous line:
E.g.:
I have an xml file and Contents as below:
<Root>
<NameValue>
<name>Global/Text/Data</name>
<value>This is valid... (14 Replies)
Discussion started by: mailing2vamsi
14 Replies
8. Shell Programming and Scripting
Hello,
I have a file name like FIRST_DPF_DAILY_CUST_0826152322.txt
i need to extract the string after the third "_" underscore upto timestamp ends i.e CUST_0826152322
can anyone help me with the code
Thank you!
Regards
Srikanth Sagi (3 Replies)
Discussion started by: srikanth_sagi
3 Replies
9. UNIX for Dummies Questions & Answers
Hi
I have a large txt file on my AIX server and I need to replace some text using two other files. So filename1 has about 500 lines similar to:
txtcode SYStem100
I have the string I want to change in string2 and the new stringname in string3. Does anyone know a way of doing this? I have... (1 Reply)
Discussion started by: Grueben
1 Replies
10. Shell Programming and Scripting
I am trying to read a value from a mapping file and would need to replace the value based on country parameter
source_table_@ctry_final
Expected
final_var=source_table_aus_final
If the country is in nz,usa,uk then
final_var=diff_table_nz_final
final_var=diff_table_usa_final
like that... (10 Replies)
Discussion started by: Master_Mind
10 Replies
LEARN ABOUT OSX
page_util_norm_peg
page_util_norm_peg(n) Parser generator tools page_util_norm_peg(n)
__________________________________________________________________________________________________________________________________________________
NAME
page_util_norm_peg - page AST normalization, PEG
SYNOPSIS
package require page::util::norm_peg ?0.1?
package require snit
::page::util::norm::peg tree
_________________________________________________________________
DESCRIPTION
This package provides a single utility command which takes an AST for a parsing expression grammar and normalizes it in various ways. The
result is called a Normalized PE Grammar Tree.
Note that this package can only be used from within a plugin managed by the package page::pluginmgr.
API
::page::util::norm::peg tree
This command assumes the tree object contains for a parsing expression grammar. It normalizes this tree in place. The result is
called a Normalized PE Grammar Tree.
The following operations are performd
[1] The data for all terminals is stored in their grandparental nodes. The terminal nodes and their parents are removed. Type
information is dropped.
[2] All nodes which have exactly one child are irrelevant and are removed, with the exception of the root node. The immediate
child of the root is irrelevant as well, and removed as well.
[3] The name of the grammar is moved from the tree node it is stored in to an attribute of the root node, and the tree node
removed.
The node keeping the start expression separate is removed as irrelevant and the root node of the start expression tagged with
a marker attribute, and its handle saved in an attribute of the root node for quick access.
[4] Nonterminal hint information is moved from nodes into attributes, and the now irrelevant nodes are deleted.
Note: This transformation is dependent on the removal of all nodes with exactly one child, as it removes the all 'Attribute'
nodes already. Otherwise this transformation would have to put the information into the grandparental node.
The default mode given to the nonterminals is value.
Like with the global metadata definition specific information is moved out out of nodes into attributes, the now irrelevant
nodes are deleted, and the root nodes of all definitions are tagged with marker attributes. This provides us with a mapping
from nonterminal names to their defining nodes as well, which is saved in an attribute of the root node for quick reference.
At last the range in the input covered by a definition is computed. The left extent comes from the terminal for the nontermi-
nal symbol it defines. The right extent comes from the rightmost child under the definition. While this not an expression
tree yet the location data is sound already.
[5] The remaining nodes under all definitions are transformed into proper expression trees. First character ranges, followed by
unary operations, characters, and nonterminals. At last the tree is flattened by the removal of superfluous inner nodes.
The order matters, to shed as much nodes as possible early, and to avoid unnecessary work later.
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, graph walking, normalization, page, parser generator, text processing, tree walking
CATEGORY
Page Parser Generator
COPYRIGHT
Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>
page 1.0 page_util_norm_peg(n)