Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

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

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

NAME
CheckDigits::M43_001 - compute check digits for Code-39 SYNOPSIS
use Algorithm::CheckDigits; $c39 = CheckDigits('code_39'); if ($c39->is_valid('AB-123K')) { # do something } $cn = $c39->complete('AB-123'); # $cn = 'AB-123K' $cd = $c39->checkdigit('AB-123K'); # $cd = 'K' $bn = $c39->basenumber('AB-123K'); # $bn = 'AB-123' DESCRIPTION
ALGORITHM 1. After replacing all non numeric letters with their respective values, the sum of all numbers is computers 2. The checkdigit is the sum from step 1 taken modulo 43. 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::M43_001(3pm)

Check Out this Related Man Page

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

NAME
CheckDigits::M11_002 - compute check digits for PZN (DE) SYNOPSIS
use Algorithm::CheckDigits; $pzn = CheckDigits('pzn'); if ($pzn->is_valid('4877800')) { # do something } $cn = $pzn->complete('487780'); # $cn = '4877800' $cd = $pzn->checkdigit('4877800'); # $cd = '0' $bn = $pzn->basenumber('4877800'); # $bn = '487780' DESCRIPTION
ALGORITHM 1. From left to right beginning with the first position all digits are multiplied with 2,3,4,... 2. The sum of all products is computed. 3. The checkdigit ist the sum of step 2 taken modulo 11. 4. If the checkdigit is '10' the whole number is not taken as a PZN. 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::M11_002(3pm)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Noob question on comparing #'s.

I have a file with 3 digit numbers in it formatted as such: 123 065 321 How would I go about seeing if each number is less than 100 and if so outputting it to another file Yes, I am a bit of a noob. I have tried with grep but I don't think it'll work. Any general direction would be... (6 Replies)
Discussion started by: kirkm76
6 Replies

2. Shell Programming and Scripting

How to check for a valid numeric input

Hi Folks, I'm using bash script. I would like to check whether input is a number or not.(Only positive numbers).. if space or non numeric is entered, it should say "invalid input". pls help.. thanks in adv. Br/// Vijay. (1 Reply)
Discussion started by: Vijayakumarpc
1 Replies

3. Shell Programming and Scripting

to find numbers in a string

I writing my script and got stuck in this function. Can someone help me? I need to extract out the numbers inside a string. Ex: INPUT -> OUTPUT abcdef123 -> 123 abc123def -> 123 123abcdef -> 123 a123bc45d -> 123 45 abcdefghi -> -1 Thank you! (12 Replies)
Discussion started by: fongthai
12 Replies

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

5. Shell Programming and Scripting

How get numbers only?

I have a file with the following contents..say 123 abc 90and / 1009 from which i only need numbers to be printed. like 123 90 1009 using any shell command. Thanks. (7 Replies)
Discussion started by: vijay_0209
7 Replies

6. Shell Programming and Scripting

how to grep only particular length of numeric values

hi i have two types of file 1. temp.0000000001.data (10 digit numeric) 2. temp.000000001.data (9 digit numeric) i want to search a file which is having 10 digit numeric in between the file name. i use command like this.. ls | grep temp.^*.data but this will give both the files as... (2 Replies)
Discussion started by: somi2yoga
2 Replies

7. Shell Programming and Scripting

perl or awk, field length check

Hi Everyone, 1.txt a;1234;134;1111111 b;123;123;1111111 c;123;1334;1111111 d;1234;1234;1111111 output a;1234;134;1111111 c;123;1334;1111111 d;1234;1234;1111111 if field2 legth>3 or field3 length >3, then output. Please advice. Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies

8. Shell Programming and Scripting

check if a string is numeric

I checked all the previous threads related to this and tried this. My input is all numbers or decimals greater than zero everytime. I want to check the same in the korn shell script. Just validate the string to be numeric. This is what I am doing. var="12345" if ) -o "$var" !=... (14 Replies)
Discussion started by: megha2525
14 Replies

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

10. Shell Programming and Scripting

Adding "1.123+4.242 = 5" problem

I wan't to add two numbers (e.g 1.123 and 4.242) from different files but the add operation seems to cut the decimals. Any ideas how to convert or rewrite? (The numbers in the file are in 1.123 and not 1,123) ------------------- awk 'NR>9{print $3,$4,$5}' rlx.4000.dump > pos_0 awk... (5 Replies)
Discussion started by: tommya
5 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

Replacing digits using sed

How to replace a character followed by a digit using sed? For example lets say I have this file - a1 3242134 54235435 3241235 a2 3214345 45325626 3125435 a3 4236577 54365376 6865678 . . . a3000 5432534 32546546 3254365 I want to replace all... (6 Replies)
Discussion started by: saleheen
6 Replies

13. Shell Programming and Scripting

Question about enviroment variable.

Hi Gurus, I am stuck on below issue. in my .profile. I have two variable: x=abc$123 t=xyz$ when running env command, I got below: x=abc t=xyz$ my OS is SunOS 5.10 sun4v sparc SUNW,SPARC-Enterprise-T5220 I am wondering why t=xyz$ shows exactly value? I try below: (9 Replies)
Discussion started by: ken6503
9 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. Shell Programming and Scripting

Sum up formatted numbers with comma separation

I need to sum up the values in field nr 5 in a data file that contains some file listing. The 5th field denotes the size of each file and following are some sample values. 1,775,947,633 4,738 7,300 16,610 15,279 0 0 I tried the following code in a shell script. awk '{sum+=$5} END{print... (4 Replies)
Discussion started by: krishmaths
4 Replies