Sponsored Content
Top Forums Shell Programming and Scripting PERL: Simple reg expr validate 6 digits number Post 302234805 by BufferExploder on Wednesday 10th of September 2008 11:15:36 AM
Old 09-10-2008
Thank you very much Ikon for this solution!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

validate number range

Hi If I want to read user input and want to validate if it is a numeric number in some range of 1-100 what would be the best way? Sabina (5 Replies)
Discussion started by: sabina
5 Replies

2. Shell Programming and Scripting

Text replace by position instead of reg expr.

Can we replace the contents the of the rows of file, from one position to another position by mentioning, some start position & the width? (4 Replies)
Discussion started by: videsh77
4 Replies

3. Shell Programming and Scripting

var substitution in a reg expr ?

In a shell script, how I can achieve substitution of shell script var to a regular expression, as shown below. var=`head -1 file1` awk '$0!~/$var/ {print $0}' file1 > file2 In the case above $var value literally considered for non-exists criteria. (3 Replies)
Discussion started by: videsh77
3 Replies

4. UNIX for Dummies Questions & Answers

scipt dividing strings /reg expr

Hello! I've got txt-file containing lots of data in sentences like this: ;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON; but sometime more than on in a line like this: ;;BA;00:00:03:00;COM;CLOQUET-LAFOLLYE;SIMON;;;BA;00:00:03:00;REA;RTL9;;;;BAC;:00;TIT;SEMAINE SPECIALE ~SSLOGAN~T DVD;; ... (3 Replies)
Discussion started by: maco_home
3 Replies

5. Shell Programming and Scripting

how can i find sqrt of a any number without using expr

hi friends can any body tell me how can i find sqrt of a any given number without using expr in bash shell while i am doing i got some errors please take a look and code is here x=$((( ( sqrt($1) ) | bc ))) echo $x $ sh quadratic-eqn-roots.sh 9 quadratic-eqn-roots.sh: line 12: ( (... (6 Replies)
Discussion started by: srinivas2828
6 Replies

6. Shell Programming and Scripting

print column that match reg expr

Hi all, I want to cut a column which match the regular expression "beta", if I don't know the column number? cat test alpha;beta;gamma 11;22;33 44;55;66 77;88;99 should be command .... beta 22 55 (6 Replies)
Discussion started by: research3
6 Replies

7. Shell Programming and Scripting

HowTo: reg expr doing grep "timestamp>$DesiredTime" logfile ?

I know I asked a similar question but I want to know if there is a regular expression existing that with a korn shell cmd, finds any timestamp data records in a file where it is greater then a timestamp in a shell variable ? something like : grep all records where it has a timestamp >... (5 Replies)
Discussion started by: Browser_ice
5 Replies

8. Shell Programming and Scripting

perl: reg.expr: combine starting and ending removal in one exprecion

Hello, I am new in perl and in regular exprecion; so I am looking for help (or an experienced advise.) The target is a triming spaces from a string: i.e., remove spases from begining and from end of a string. One of main point of a searched solution is performance: for current task it is... (2 Replies)
Discussion started by: alex_5161
2 Replies

9. Programming

How to prevent incorrect string using reg expr in Java?

Hi All, I need your input on how to mask out / ignore a string that does not match a working regular expression (continually refining) pattern in Java. Below is the code snippet which is picking up all the lines with the correct regular expression string except one known so far: public... (0 Replies)
Discussion started by: gjackson123
0 Replies

10. Shell Programming and Scripting

number of digits after decimal

Hi All, I have a file of decimal numbers, cat file1.txt 1.1382666907 1.2603107334 1.6118799297 24.4995857056 494.7632588468 560.7633734425 ..... I want to see the output as only 7 digits after decimal (5 Replies)
Discussion started by: senayasma
5 Replies
CheckDigits::M11_011(3pm)				User Contributed Perl Documentation				 CheckDigits::M11_011(3pm)

NAME
CheckDigits::M11_011 - compute check digits for VAT Registration Number (NL) SYNOPSIS
use Algorithm::CheckDigits; $ustid = CheckDigits('ustid_nl'); if ($ustid->is_valid('123456782')) { # do something } if ($ustid->is_valid('123456782B04')) { # do something } $cn = $ustid->complete('12345678'); # $cn = '123456782' $cn = $ustid->complete('12345678.B04'); # $cn = '123456782B04' $cd = $ustid->checkdigit('123456782'); # $cd = '2' $cd = $ustid->checkdigit('123456782B04'); # $cd = '2' $bn = $ustid->basenumber('123456782'); # $bn = '12345678'; $bn = $ustid->basenumber('123456782B04'); # $bn = '12345678.B04'; DESCRIPTION
This VATRN has 12 "digits", the third last must be a B, the fourth last is the checkdigit. I don't know anything about the meaning of the last two digits. You may use the whole VATRN or only the first eight digits to compute the checkdigit with this module. ALGORITHM 1. Beginning right with the digit before the checkdigit all digits are weighted with their position. I.e. the digit before the checkdigit is multiplied with 2, the next with 3 and so on. 2. The weighted digits are added. 3. The sum from step 2 is taken modulo 11. 4. If the sum from step 3 is 10, the number is discarded. METHODS is_valid($number) Returns true only if $number consists solely of numbers and hyphens and the two digits in the middle are valid check digits according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and inserted into the middle of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits, hyphens and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the check digits of $number if $number has valid check digits. Return '' otherwise. EXPORT None by default. SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de, AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> COPYRIGHT AND LICENSE
Copyright 2004,2005 by Mathias Weidner This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2008-05-17 CheckDigits::M11_011(3pm)
All times are GMT -4. The time now is 01:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy