05-11-2010
What do you want to achieve? Looks like you want to match strings containing 4 digits
![Confused Smilie](https://www.unix.com/images/smilies/confused.gif)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have file 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies
2. Shell Programming and Scripting
Hi all, how could i do ?
I have a Rss file, i want to extract only the Urls (many) matching http://www.xxx.com/trailers/ from that file and copy into another file.
like
"
<pubDate>Wed, 29 Apr 2009 00:00:00 PST</pubDate>
<content:encoded><!Apple - Movie Trailers - The Hangover"><img... (3 Replies)
Discussion started by: BremboloIV
3 Replies
3. Shell Programming and Scripting
Hello everyone, this is my first post so please give me a hand.
I apologize for my English, I'll try to be clear with my request.
I need to write a script (Bash) which finds all the variables defined in the file .h of the folder and then writes the name of the files .c where these variables are... (1 Reply)
Discussion started by: paxilpaz
1 Replies
4. Shell Programming and Scripting
Hi there,
i'm having some problems just making an awk script (i've tried this way, but other way can be posible for sure), for the next file
file.txt
<register>
<createProfile>
<result>0</result>
<description><!]></description>
<msisdn>34661461174</msisdn>
<inputOmvID>1</inputOmvID>... (6 Replies)
Discussion started by: vicious
6 Replies
5. Shell Programming and Scripting
Hi All ,
I need to extract the strings that are matching with the pattern : CUST.<AnyStringOfAnyLength>.<AnyStringOfAnyLength> from a file and then write all these string into another file.
e.g. If a file SOURCE contains following lines :
IF(CUST.ABCD.EFGH==1) THEN
CUST.ABCD.EFGH =... (7 Replies)
Discussion started by: swapnil.nawale
7 Replies
6. Shell Programming and Scripting
Guys, i'm new to shell scripting. Here's what i need.
I need a shell script which would read a file containing only 1 line which never changes.
File containts -
SQL_Mgd_Svc_ELONMCL54496 |EMEA\brookkev, EMEA\fieldgra, EMEA\tidmamar, EMEA\attfiste, EMEA\baldogar, EMEA\clarkia2, EMEA\conwasha,... (9 Replies)
Discussion started by: butterfly20
9 Replies
7. Shell Programming and Scripting
Hi All,
I am writing the following Perl Scrip and need your help in Pattern matching :
I have the following Shell Script that would read line by line from the file (file_svn) and would inturn calls the Perl Script:
#!/bin/bash
perl_path="/home/dev/filter"... (2 Replies)
Discussion started by: filter
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have a string looks like the following:
USERS 32767.9844 UNDOTBS1 32767.9844 SYSAUX 32767.9844 SYSTEM 32767.9844 EMS 8192 EMS 8192 EMS_INDEXES 4096 EMS_INDEXES 4096 8 rows selected.
How do I extract a sub-string to get the expected output as following:
EMS 8192
EMS_INDEXES 4096
... (3 Replies)
Discussion started by: NetBear
3 Replies
9. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
10. Shell Programming and Scripting
The sample file:
dept1: user1,user2,user3
dept2: user4,user5,user6
dept3: user7,user8,user9
I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies
LEARN ABOUT DEBIAN
math::basecalc
Math::BaseCalc(3pm) User Contributed Perl Documentation Math::BaseCalc(3pm)
NAME
Math::BaseCalc - Convert numbers between various bases
VERSION
version 1.016
SYNOPSIS
use Math::BaseCalc;
my $calc = new Math::BaseCalc(digits => [0,1]); #Binary
my $bin_string = $calc->to_base(465); # Convert 465 to binary
$calc->digits('oct'); # Octal
my $number = $calc->from_base('1574'); # Convert octal 1574 to decimal
DESCRIPTION
This module facilitates the conversion of numbers between various number bases. You may define your own digit sets, or use any of several
predefined digit sets.
The to_base() and from_base() methods convert between Perl numbers and strings which represent these numbers in other bases. For instance,
if you're using the binary digit set [0,1], $calc->to_base(5) will return the string "101". $calc->from_base("101") will return the number
5.
To convert between, say, base 7 and base 36, use the 2-step process of first converting to a Perl number, then to the desired base for the
result:
$calc7 = new Math::BaseCalc(digits=>[0..6]);
$calc36 = new Math::BaseCalc(digits=>[0..9,'a'..'z']);
$in_base_36 = $calc36->to_base( $calc7->from_base('3506') );
If you just need to handle regular octal & hexdecimal strings, you probably don't need this module. See the sprintf(), oct(), and hex()
Perl functions.
METHODS
o new Math::BaseCalc
o new Math::BaseCalc(digits=>...)
Create a new base calculator. You may specify the digit set to use, by either giving the digits in a list reference (in increasing
order, with the 'zero' character first in the list) or by specifying the name of one of the predefined digit sets (see the digit()
method below).
If your digit set includes the character "-", then a dash at the beginning of a number will no longer signify a negative number.
o $calc->to_base(NUMBER)
Converts a number to a string representing that number in the associated base.
If "NUMBER" is a "Math::BigInt" object, "to_base()" will still work fine and give you an exact result string.
o $calc->from_base(STRING)
Converts a string representing a number in the associated base to a Perl integer. The behavior when fed strings with characters not in
$calc's digit set is currently undefined.
If "STRING" converts to a number too large for perl's integer representation, beware that the result may be auto-converted to a
floating-point representation and thus only be an approximation.
o $calc->digits
o $calc->digits(...)
Get/set the current digit set of the calculator. With no arguments, simply returns a list of the characters that make up the current
digit set. To change the current digit set, pass a list reference containing the new digits, or the name of a predefined digit set.
Currently the predefined digit sets are:
bin => [0,1],
hex => [0..9,'a'..'f'],
HEX => [0..9,'A'..'F'],
oct => [0..7],
64 => ['A'..'Z','a'..'z',0..9,'+','/'],
62 => [0..9,'a'..'z','A'..'Z'],
Examples:
$calc->digits('bin');
$calc->digits([0..7]);
$calc->digits([qw(w a l d o)]);
If any of your "digits" has more than one character, the behavior is currently undefined.
QUESTIONS
The '64' digit set is meant to be useful for Base64 encoding. I took it from the MIME::Base64.pm module. Does it look right? It's sure
in a strange order.
AUTHOR
Ken Williams, ken@forum.swarthmore.edu
COPYRIGHT
This is free software in the colloquial nice-guy sense of the word. Copyright (c) 1999, Ken Williams. You may redistribute and/or modify
it under the same terms as Perl itself.
SEE ALSO
perl(1).
perl v5.12.3 2011-05-16 Math::BaseCalc(3pm)