It gives me the number, but also changes the entire line of the file to just have word1_a123456 as that line. I don't want to change the whole line, just find the word1_a#'s so I can use it as a variable later. I also need all instances of word1_a#'s on the same line. It only shows me the last instance on the line.
I'm not actually looking to replace the information I find yet, just find it and figure out what the 6 numbers are after it.
Ultimately my script will replace the information that is between the :'s where the word1_a is found, but I have to figure out what the 6#'s are so I can change the correct portion of the line.
Orignal file:
Ending result:
I plan on using sed to put the newinfo in the file, once I figure out what the numbers are after word1_a.
Thanks again!
---------- Post updated 12-30-10 at 07:50 AM ---------- Previous update was 12-29-10 at 10:10 AM ----------
I have this sort of working. I am using the following code (thanks to verdepollo) with the addition of the the -n -e to get only the string I am looking for. However, if there are multiple instances of the string on one line, I am only getting the last one. I need to get all of them, where ever they are in the file.
Hi all,
I have a file with lines written somewhat like this.
aaaa
ccc
aa
linux
browse = no
xssxw
cdcedc
dcsdcd
csdw
police
dwed
dwd
browse = no
cdecec (2 Replies)
Hi ALL,
I want to search one string “20 “ i.e 20 with space.
But my file where I am searching this “20 “ contain some data like
120 before image file truncated
220 Reports section succeeded
20 Transaction database .prd stopped
220 Reports section completed.
When I search for the... (5 Replies)
Suppose that I have a string "one:#red two:#yellow three:#gr'een four:#blu^e" and I want to replace the pattern :# and the following characters in the word with nothing. The output string should look "one two three four" How can I do this with sed.
Some points to consider (a) the last word in... (1 Reply)
Hello,
I have several xml files from which I want to find and return a particular string
I want to locate the InId="00000008". Now that is inlcuded within a tag and ofcourse the number is different every time
this is what I came up with given that after greping the line that contains the... (6 Replies)
Hello Experts,
I have to count the word like "RESULT_CODE: : -6" from the multiple files names like req.result_2_vqx-71144750.log for a particular date. Lets suppose the date is 10 OCT 2011.
How I can do it with a single command in Solaris environment.
Reagrds
Oracle User (8 Replies)
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Hi all
I am working on disallowing users to use easy passwords in pam.d setting on RHEL 5.7 and SuSe 11, and I was hoping to add more words into the current cracklib dict, so I use "echo" command to append new words into the file
I dont want to add the same words into the dict, I think I... (2 Replies)
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word description excluding weird characters like $$#$#@$#@***$# and without html tags in the new file output.txt. Help me. Thanx in advance.
My final goal is to... (11 Replies)
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Hello,
I want to add a sentence to "post column" those who are only less than 30 characters.Thank you very much for your help.
"category","title","post"
"Z","Zoo","test 54325 test 45363mc."
"Z","Zen","rs2w3rsj 2d342dg 2d3s4f23 d23423s23h 2s34s2423g ds232d34 2342."
"Z","Zet","test4444... (3 Replies)
Discussion started by: hoo
3 Replies
LEARN ABOUT MOJAVE
netaddr::ip::utilpp5.18
NetAddr::IP::UtilPP(3) User Contributed Perl Documentation NetAddr::IP::UtilPP(3)NAME
NetAddr::IP::UtilPP -- pure Perl functions for NetAddr::IP::Util
SYNOPSIS
use NetAddr::IP::UtilPP qw(
hasbits
shiftleft
addconst
add128
sub128
notcontiguous
ipv4to6
mask4to6
ipanyto6
maskanyto6
ipv6to4
bin2bcd
bcd2bin
);
use NetAddr::IP::UtilPP qw(:all)
$rv = hasbits($bits128);
$bitsX2 = shiftleft($bits128,$n);
$carry = addconst($ipv6naddr,$signed_32con);
($carry,$ipv6naddr)=addconst($ipv6naddr,$signed_32con);
$carry = add128($ipv6naddr1,$ipv6naddr2);
($carry,$ipv6naddr)=add128($ipv6naddr1,$ipv6naddr2);
$carry = sub128($ipv6naddr1,$ipv6naddr2);
($spurious,$cidr) = notcontiguous($mask128);
($carry,$ipv6naddr)=sub128($ipv6naddr1,$ipv6naddr2);
$ipv6naddr = ipv4to6($netaddr);
$ipv6naddr = mask4to6($netaddr);
$ipv6naddr = ipanyto6($netaddr);
$ipv6naddr = maskanyto6($netaddr);
$netaddr = ipv6to4($pv6naddr);
$bcdtext = bin2bcd($bits128);
$bits128 = bcd2bin($bcdtxt);
DESCRIPTION
NetAddr::IP::UtilPP provides pure Perl functions for NetAddr::IP::Util
o $rv = hasbits($bits128);
This function returns true if there are one's present in the 128 bit string and false if all the bits are zero.
i.e. if (hasbits($bits128)) {
&do_something;
}
or if (hasbits($bits128 & $mask128) {
&do_something;
}
This allows the implementation of logical functions of the form of:
if ($bits128 & $mask128) {
...
input: 128 bit IPv6 string
returns: true if any bits are present
o $bitsXn = shiftleft($bits128,$n);
input: 128 bit string variable,
number of shifts [optional]
returns: bits X n shifts
NOTE: input bits are returned
if $n is not specified
o addconst($ipv6naddr,$signed_32con);
Add a signed constant to a 128 bit string variable.
input: 128 bit IPv6 string,
signed 32 bit integer
returns: scalar carry
array (carry, result)
o add128($ipv6naddr1,$ipv6naddr2);
Add two 128 bit string variables.
input: 128 bit string var1,
128 bit string var2
returns: scalar carry
array (carry, result)
o sub128($ipv6naddr1,$ipv6naddr2);
Subtract two 128 bit string variables.
input: 128 bit string var1,
128 bit string var2
returns: scalar carry
array (carry, result)
Note: The carry from this operation is the result of adding the one's complement of ARG2 +1 to the ARG1. It is logically NOT borrow.
i.e. if ARG1 >= ARG2 then carry = 1
or if ARG1 < ARG2 then carry = 0
o ($spurious,$cidr) = notcontiguous($mask128);
This function counts the bit positions remaining in the mask when the rightmost '0's are removed.
input: 128 bit netmask
returns true if there are spurious
zero bits remaining in the
mask, false if the mask is
contiguous one's,
128 bit cidr
o $ipv6naddr = ipv4to6($netaddr);
Convert an ipv4 network address into an ipv6 network address.
input: 32 bit network address
returns: 128 bit network address
o $ipv6naddr = mask4to6($netaddr);
Convert an ipv4 netowrk address into an ipv6 network mask.
input: 32 bit network/mask address
returns: 128 bit network/mask address
NOTE: returns the high 96 bits as one's
o $ipv6naddr = ipanyto6($netaddr);
Similar to ipv4to6 except that this function takes either an IPv4 or IPv6 input and always returns a 128 bit IPv6 network address.
input: 32 or 128 bit network address
returns: 128 bit network address
o $ipv6naddr = maskanyto6($netaddr);
Similar to mask4to6 except that this function takes either an IPv4 or IPv6 netmask and always returns a 128 bit IPv6 netmask.
input: 32 or 128 bit network mask
returns: 128 bit network mask
o $netaddr = ipv6to4($pv6naddr);
Truncate the upper 96 bits of a 128 bit address and return the lower 32 bits. Returns an IPv4 address as returned by inet_aton.
input: 128 bit network address
returns: 32 bit inet_aton network address
o $bcdtext = bin2bcd($bits128);
Convert a 128 bit binary string into binary coded decimal text digits.
input: 128 bit string variable
returns: string of bcd text digits
o $bits128 = bcd2bin($bcdtxt);
Convert a bcd text string to 128 bit string variable
input: string of bcd text digits
returns: 128 bit string variable
EXPORT_OK
hasbits
shiftleft
addconst
add128
sub128
notcontiguous
ipv4to6
mask4to6
ipanyto6
maskanyto6
ipv6to4
bin2bcd
bcd2bin
comp128
bin2bcdn
bcdn2txt
bcdn2bin
simple_pack
threads
AUTHOR
Michael Robinton <michael@bizsystems.com>
COPYRIGHT
Copyright 2003 - 2012, Michael Robinton <michael@bizsystems.com>
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any
later version, or
b) the "Artistic License" which comes with this distribution.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.
You should have received a copy of the Artistic License with this distribution, in the file named "Artistic". If not, I'll be glad to
provide one.
You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write
to the
Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
or visit their web page on the internet at:
http://www.gnu.org/copyleft/gpl.html.
AUTHOR
Michael Robinton <michael@bizsystems.com>
perl v5.18.2 2012-08-10 NetAddr::IP::UtilPP(3)