Sponsored Content
Full Discussion: how to delete 2 digit
Top Forums Shell Programming and Scripting how to delete 2 digit Post 302348301 by Gopal_Engg on Friday 28th of August 2009 01:10:36 AM
Old 08-28-2009
how to delete 2 digit

I have string like

abcdefgh

i want to delete first two digit of the string. output should be

cdefgh


plz give me solution
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

why "expr "${REPLY}" : '\([1-9][[:digit:]]*\)" can figure out whether it is a digit?

I found below script to check whether the variable is a digit in ksh. ############################ #!/bin/ksh REPLY="3f" if ]*\)'` != ${REPLY} && "${REPLY}" != "0" ]] then print "is digit\n" else print "not digit\n" fi ############################ Although it works fine, but... (6 Replies)
Discussion started by: sleepy_11
6 Replies

2. Shell Programming and Scripting

Replace one digit by two digit using sed

Folks, Is there a simple way to replace one digit by two digit using sed. Example, mydigit1918_2006_8_8_lag1.csv should be mydigit1918_2006_08_08_lag01.csv. I tried this way, but doesn't work. echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/' Thank you, (5 Replies)
Discussion started by: Jae
5 Replies

3. Shell Programming and Scripting

How to convert a 2 digit to 4 digit

Hi All, How can i convert a number 24 to 0024 In the same way how can i convert 123 to 0123? All this has to be done inside a script Thanks in advance JS (6 Replies)
Discussion started by: jisha
6 Replies

4. Shell Programming and Scripting

Single digit date to double digit date.

I have a var storing date var=`date` Now the date is returned as Mon Feb 2 00:25:48 PST 2009 Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var" My intention in above case is... (3 Replies)
Discussion started by: villain41
3 Replies

5. Shell Programming and Scripting

sed - delete everything until the first digit comes up

Hi, I have a text file with content as follows: bla foo3200492 comment on this: 3900302 here comes the teddy 12 all I need is: 3200492 3900302 12 So I need the correct "sed" command to delete everything until the first number. I am not a regex expert, because I have to... (3 Replies)
Discussion started by: mcW
3 Replies

6. Shell Programming and Scripting

script to delete one digit.

Hi User, I have a text file with a lot of customer records (over 10,000). Each record contained one field called "charge" and it must start with some space (each record may have 15 space, 17 spece, 9 space,etc, then start with <charge> and end with </charge>, in between is a value. How can I... (3 Replies)
Discussion started by: happyv
3 Replies

7. Shell Programming and Scripting

awk length of digit and print at most right digit

Have columns with digits and strings like: input.txt 3840 3841 3842 Dav Thun Tax Cahn 146; Dav. 3855 3853 3861 3862 Dav Thun Tax 2780 Karl VI., 3873 3872 3872 Dav Thun Tax 3894 3893 3897 3899 Dav Thun Tax 403; Thun 282. 3958 3959 3960 Dav Thun Tax 3972 3972 3972 3975 Dav Thun Tax... (8 Replies)
Discussion started by: sdf
8 Replies

8. Shell Programming and Scripting

how to delete the line if the first letter is a single digit

Hi, I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line, if it starts with 2 or more digits then i have to keep the line Here is a sample of my file: 377 CARRER DE LA... (5 Replies)
Discussion started by: ramky79
5 Replies

9. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

10. Shell Programming and Scripting

How to delete only the last digit in string

Hello, I would like to convert this string KBL3TEST1 into KBL3TEST How can i code this? Any help is appreciated regards, blashyou (6 Replies)
Discussion started by: blashyou
6 Replies
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)
All times are GMT -4. The time now is 10:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy