Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

algorithm::checkdigits::m23_002(3pm) [debian man page]

CheckDigits::M23_002(3pm)				User Contributed Perl Documentation				 CheckDigits::M23_002(3pm)

NAME
CheckDigits::M23_002 - compute check digits for VAT Registration Number (IE) SYNOPSIS
use Algorithm::CheckDigits; $dni = CheckDigits('ustid_ie'); if ($dni->is_valid('8473625E')) { # do something } $cn = $dni->complete('8473625'); # $cn = '8473625E' $cd = $dni->checkdigit('8473625E'); # $cd = 'E' $bn = $dni->basenumber('8473625E'); # $bn = '8473625' DESCRIPTION
ALGORITHM 1. Beginning right all digits are weighted with their position in the number (i.e. the number left from the check digit is multiplied with 2, the next with 3 and so on). 2. All products are added. 3. The check digit is the sum from step 2 modulo 23. This number is expressed as the corresponding letter from the alphabet where A-V correspond to 1-22 and W stands for check digit 0. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::M23_002(3pm)

Check Out this Related Man Page

CheckDigits::MXX_004(3pm)				User Contributed Perl Documentation				 CheckDigits::MXX_004(3pm)

NAME
CheckDigits::MXX_004 - compute check digits for VAT RN (AT) SYNOPSIS
use Algorithm::CheckDigits; $vat = CheckDigits('ustid_at'); if ($vat->is_valid('U13585627')) { # do something } $cn = $vat->complete('U1358562'); # $cn = 'U13585627' $cd = $vat->checkdigit('U13585627'); # $cd = '7' $bn = $vat->basenumber('U13585627'); # $bn = 'U1358562' DESCRIPTION
ALGORITHM 1. Beginning right all numbers before the check digit are weighted alternatively 1 and 2. 2. The total of the digits of all products is computed and then subtracted from 96. 3. The check digit is the sum of step 3 taken modulo 10. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::MXX_004(3pm)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Stripping all content but an integer

Hello! I have content in a log file that consists of a lot of spaces before and after a 3 digit integer which I need to strip out before I can use the file. The number of digits can change. When I had my logic in a 'for' loop and could output into another file, it was fine. but it turns out... (10 Replies)
Discussion started by: tekster757
10 Replies

2. 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

3. 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

4. Programming

Find out 2^n+1 , where n is a 3 digit number

I have to write a c program which takes a 3 digit number n and calculates the value of (2^n)+1 and then determines the number is prime or not. I have tried to first calculate the value of 2^n and then adding one to it and then apply the logic of prime number. but the ultimate problem is that... (7 Replies)
Discussion started by: agrawal.prachi
7 Replies

5. UNIX for Dummies Questions & Answers

list all files containing 4 digit number using grep

how can i list all files in my home directory that have a 4 digit id number, the line number where the id is located and the id itself not printing the entire line? (5 Replies)
Discussion started by: hobiwhenuknowme
5 Replies

6. Programming

Problem with Sprintf

Hi, I have the below sample code to hash the input number read from file. File will have 16 to 19 digit number and executable hash the number using some logic and returns the hashed value. Each digit in the 16 digit number is converted to a 4 byte value. That if the input is 16digit integer, the... (6 Replies)
Discussion started by: ramkrix
6 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

RegEX question

Hi, I am trying to write a regex for myscript and need some input from experts. here is what I must grep for TICKET{Sapce}{Space}{hyphen} so here is the example data TICKET 34554, CT-12345, TICKET 12345: some text here TICKET 2342, CT-12345, MA-12344: some text here TICKET... (5 Replies)
Discussion started by: rider29
5 Replies

9. 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

10. Shell Programming and Scripting

Split a file into multiple files based on first two digits of file.

Hi , I do have a fixedwidth flatfile that has data for 10 different datasets each identified by the first two digits in the flatfile. 01 in the first two digit position refers to Set A 02 in the first two digit position refers to Set B and so on I want to genrate 10 different files from my... (6 Replies)
Discussion started by: okkadu
6 Replies

11. Shell Programming and Scripting

sed & remove duplicates on output

sed -e '1d' -e 's/^\(]\{2\}\)-\(]\{3\}\)-\(]\{4\}\).*/"0000020\1\200\3"\,/g' abc.txt This script returns many duplicates due to the duplciates in the .txt file. i.e. ... "000002012149000060", "000002012149000064", "000002012149000064", "000002012149000064", "000002012149000064",... (9 Replies)
Discussion started by: Daniel Gate
9 Replies

12. UNIX for Dummies Questions & Answers

How to check if file contains valid strings?

Hi All, I am a newbie...I would like to have a function which ll check if a file contains valid strings before "=" operator. Just to give you my requirement: assume my file has content: hello= gsdgsd sfdsg sgdsg sgdgdg world= gggg hhhh iiiii xxxx= pppp ppppp pppp my... (5 Replies)
Discussion started by: rtagarra
5 Replies

13. Programming

6 digits combination

Is there any program that can create 6 digit numbers with: (DIGIT_1)+(DIGIT_2)+(DIGIT_3)+(DIGIT_4)+(DIGIT_5)+(DIGIT_6)=10 Any perl or C also can. Anyone can help me? Thank you (6 Replies)
Discussion started by: Tzeronone
6 Replies

14. Shell Programming and Scripting

Perl to run different parser based on digit

The perl parser below works as expected assuming the last digit in the NC_ before the . is a single digit. perl -ne 'next if $. == 1; if(/.*del(+)ins(+).*NC_0{4}(+).*g\.(+)_(+)/) # indel { print join("\t", $3, $4, $5, $1, $2), "\n"; } ' out_position.txt > out1.txt ... (8 Replies)
Discussion started by: cmccabe
8 Replies

15. UNIX for Beginners Questions & Answers

List all file whose 3rd char is digit

list all file whose 3rd char is digit (or Nth position is digit) what will be the required command? (5 Replies)
Discussion started by: rahul
5 Replies