05-14-2013
Hi DGPickett,
Yes, the replaced IP string should contain equal number of letter for equal number of digits, like-
12.56.123.9 ->XX.XX.XXX.X
128.32.56.110 -> YYY.YY.YY.YYY
thanks for the reply.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
2. Shell Programming and Scripting
Hello,
I really would appreciate some help with a bash script for some string manipulation on an SQL dump:
I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump.
This is quite easy with sed:
sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies
3. Shell Programming and Scripting
Hi, i read couple of threads here on forum, and googled about what bugs me, yet i still can't find solution.
Problem is below.
I need to change this string (with sed if it is possible):
This is message text that is being quoted
to look like this:
This is message text that is being quotedI... (2 Replies)
Discussion started by: angrybb
2 Replies
4. Shell Programming and Scripting
Hi There...
I need to serach and replace a strings in a text file.
My file has; books.amazon='Let me read' and the output needed is
books.amazon=NONFOUND
pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Discussion started by: Hiano
7 Replies
5. Shell Programming and Scripting
Hi All,
I need to serach and replace a strings between single quote in a file.
My file has :
location='/data1/test.log' and the output needed is
location='/data2/test_dir/test.log'
pls if anybody know this can be done in script sed or awk.
I have a script, but it's... (6 Replies)
Discussion started by: mnmonu
6 Replies
6. Shell Programming and Scripting
I have a list of files all over a file system e.g.
/home/1/foo/bar.x
/www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string, e.g.
if I find: '#@!^\&@ in any of the files I want to replace it with: 655#@11, etc.
There... (2 Replies)
Discussion started by: spacegoose
2 Replies
7. Shell Programming and Scripting
Based on the forums i have tried with grep command but i am unable to get the required output.
search this value /*------
If that is found then search for temp_vul and print
and also search until /*------- and print new_vul
Input file contains:
... (5 Replies)
Discussion started by: onesuri
5 Replies
8. Shell Programming and Scripting
Hi,
I am looking for a shell script which serves the below purpose.
Please find below the algorithm for the same and any help on this would be highly appreciated.
1)set of strings need to be replaced among set of files(directory may contain different types of files)
2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies
9. Shell Programming and Scripting
Hello,
I would like to replace all occurencies of long data types by others (coresponding int) using 'sed' in the extensive source code of a software package written for 32 bit CPUs.
I must use regular expressions to avoid wrong replacements like
s/unsigned]+long/ulong/gLeaving out... (2 Replies)
Discussion started by: Mick P. F.
2 Replies
LEARN ABOUT DEBIAN
xml::dtdparser
DTDParser(3pm) User Contributed Perl Documentation DTDParser(3pm)
NAME
XML::DTDParser - quick and dirty DTD parser
Version 2.01
SYNOPSIS
use XML::DTDParser qw(ParseDTD ParseDTDFile);
$DTD = ParseDTD $DTDtext;
#or
$DTD = ParseDTDFile( $dtdfile)
DESCRIPTION
This module parses a DTD file and creates a data structure containing info about all tags, their allowed parameters, children, parents,
optionality etc. etc. etc.
Since I'm too lazy to document the structure, parse a DTD you need and print the result to a file using Data::Dumper. The datastructure
should be selfevident.
Note: The module should be able to parse just about anything, but it intentionaly looses some information. Eg. if the DTD specifies that a
tag should contain either CHILD1 or CHILD2 you only get that CHILD1 and CHILD2 are optional. That is is the DTD contains <!ELEMENT FOO
(BAR|BAZ)> the result will be the same is if it contained <!ELEMENT FOO (BAR?,BAZ?)>
You get the original unparsed parameter list as well so if you need this information you may parse it yourself.
Since version 1.6 this module supports my "extensions" to DTDs. If the DTD contains a comment in form
<!--#info element=XXX foo=bar greeting="Hello World!" person='d''Artagnan'-->
and there is an element XXX in the DTD, the resulting hash for the XXX will contain
'foo' => 'bar',
'person' => 'd'Artagnan',
'greeting => 'Hello World!'
If the DTD contains
<!--#info element=XXX attribute=YYY break=no-->
the
$DTD->{XXX}->{attributes}->{YYY}->[4]
will be set to
{ break => 'no' }
I use this parser to import the DTD into the database so that I could map some fields to certain tags for output and I want to be able to
specify the mapping inside the file:
<!--#info element=TagName map_to="FieldName"-->
EXPORT
By default the module exports all (both) it's functions. If you only want one, or none use
use XML::DTDParser qw(ParseDTD);
or
use XML::DTDParser qw();
ParseDTD
$DTD = ParseDTD $DTDtext;
Parses the $DTDtext and creates a data structure. If the $DTDtext contains some <!ENTITY ... SYSTEM "..."> declarations those are read
and parsed as needed. The paths are relative to current directory.
The module currently doesn't support URLs here yet.
ParseDTDFile
$DTD = ParseDTDFile $DTDfile;
Parses the contents of $DTDfile and creates a data structure. If the $DTDfile contains some <!ENTITY ... SYSTEM "..."> declarations
those are read and parsed as needed. The paths are relative to the $DTDfile.
The module currently doesn't support URLs here yet.
FindDTDRoot
$DTD = ParseDTD $DTDtext;
@roots = FindDTDRoot $DTD;
Returns all tags that have no parent. There could be several such tags defined by the DTD. Especialy if it used some common includes.
AUTHOR
Jenda@Krynicky.cz http://Jenda.Krynicky.cz
COPYRIGHT
Copyright (c) 2002 Jan Krynicky <Jenda@Krynicky.cz>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2004-11-05 DTDParser(3pm)