May i know how to perform a search using sed? For example, a user enter a string, and i need to search it in a file details.dat to verify it. And additional how to create a auto-generate number? And it can be increment each time a record added? (1 Reply)
Hi folks,
I need to search and replace specific text in a file and replace it. I have a text file that does not have any newlines or carriage returns. All newlines have been removed. Here is what I need to do.
Find the exact string “DH” (quotes included) and replace it with \n”DH” (basically... (6 Replies)
Hello Folks,
Anyone know how I can replace this line in file.xml
<oacore_nprocs oa_var="s_oacore_nprocs">8</oacore_nprocs>
with this line
<oacore_nprocs oa_var="s_oacore_nprocs">1</oacore_nprocs>
using sed or awk ?
Thanks for your time.
Cheers,
Dave (7 Replies)
I'm not sure if the problem I'm seeing is an artifact of sed or simply a beginner's mistake. Here's the problem: I want to add a zero-width space following each underscore between XML tags. For example, if I had the following xml:
<MY_BIG_TAG>This_is_a_test</MY_BIG_TAG>
It should look like... (8 Replies)
Hello -
I have a very large file in which a certain numbers are repeated. I find that using vi to edit the entire file is useless.
How should i use sed to find a replace such as this text:
To replace: 145.D25.D558
With: 215.22.45.DW
I tried this command:
sed... (4 Replies)
Hi everyone,
basically I am been cleaning data by using simple sed commands
So what i have below has been working for me.
sed 's/="//g' trade.csv > tradeb.csv
sed 's/"//g' tradeb.csv > trade2.csv
but now i don't want to remove all the quotes just the ones if i encounter this ... (1 Reply)
I am a newbie and would like some help with the following -
Trying to search fileA for a string similar to -
AS11000022010 30.4 31.7 43.7 53.8 60.5 71.1 75.2 74.7 66.9 56.6 42.7 32.5 53.3
I then want to replace that string with a string from fileB - ... (5 Replies)
I have a file of the following
>!#jjdjahfjdhfjkds
aklsjdlkasdkashfjkdshfkjdsbfnbsdkjnfbdsk
>*kfjhdsafjdshjfkhdsjkfhdsk
wuyruiewyrieyueytireuytreyu
>-jdfhsjsjkdhfd
xzmncxzbvnmcxbvbcxn
I would like to do a wc for the lines starting with >
For the above example, the result is 3.
... (2 Replies)
Hi guys, thanks for accepting me in your forum .. I am trying to clean some hacked PHP files using SSH .. I am using this command:
find . -type f -print0 | xargs -0 sed -i '/god_mod/d'
<?php ... (3 Replies)
I would like to export the 5th line from every file within a directory. I am using GNU sed because we have no Unix or Linux environment. I used the following statement:
sed -s -n 5p c:\directory\*.*
but I only get the 5th line from one of the files in the directory. I am desperate for a... (1 Reply)
Discussion started by: hollingv
1 Replies
LEARN ABOUT DEBIAN
tree::simple::visitor::findbyuid
Tree::Simple::Visitor::FindByUID(3pm) User Contributed Perl Documentation Tree::Simple::Visitor::FindByUID(3pm)NAME
Tree::Simple::Visitor::FindByUID - A Visitor for finding an element in a Tree::Simple hierarchy by UID
SYNOPSIS
use Tree::Simple::Visitor::FindByUID;
# create a visitor object
my $visitor = Tree::Simple::Visitor::FindByUID->new();
# set the search path for our tree
$visitor->searchForUID("MyTreeUID");
# pass the visitor to a tree
$tree->accept($visitor);
# fetch the result, which will
# be the Tree::Simple object that
# we have found, or undefined
my $result = $visitor->getResult() || die "No Tree found";
DESCRIPTION
Given a UID and Tree::Simple hierarchy, this Visitor will attempt to find the node with the same UID.
METHODS
new There are no arguments to the constructor the object will be in its default state. You can use the "setNodeFilter",
"setTraversalMethod", "includeTrunk" and "searchForUID" methods to customize its behavior.
includeTrunk ($boolean)
Based upon the value of $boolean, this will tell the visitor to include the trunk of the tree in the search as well.
setTraversalMethod ($visitor)
By default we will use Tree::Simple's built in depth-first (pre-order) traverse method. If however, you desire the tree to be search in
a different ordering, this can be accomplished using a different traversal method, you can supply a $visitor object implementing that
traversal type to this method (See Tree::Simple::Visitor::BreadthFirstTraversal, Tree::Simple::Visitor::PreOrderTraversal and
Tree::Simple::Visitor::PostOrderTraversal).
searchForUID ($UID)
This is the UID we will attempt to find within the tree.
setNodeFilter ($filter_function)
This method accepts a CODE reference as its $filter_function argument and throws an exception if it is not a code reference. This code
reference is used to further check the tree nodes as they are searched and so can be used to customize search behavior. For instance,
you could to check against the UID as well as some other criteria. The filter function should accept a single argument, which is the
current Tree::Simple object and return either true(1) on success, or false(0) on failure.
visit ($tree)
This is the method that is used by Tree::Simple's "accept" method. It can also be used on its own, it requires the $tree argument to be
a Tree::Simple object (or derived from a Tree::Simple object), and will throw and exception otherwise.
getResult
This method will return the tree found with the specified UID (set by the "searchForUID" method) or "undef" if no tree is found.
BUGS
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.
CODE COVERAGE
See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more inforamtion.
SEE ALSO
These Visitor classes are all subclasses of Tree::Simple::Visitor, which can be found in the Tree::Simple module, you should refer to that
module for more information.
ACKNOWLEDGEMENTS
Thanks to Vitor Mori for the idea for this Visitor.
AUTHOR
stevan little, <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2004, 2005 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 2005-07-14 Tree::Simple::Visitor::FindByUID(3pm)