10-02-2001
Cool! This would work for 16 digit credit cards with dashes; but what if users don't put in dashes or if the 'card' number is 13, or 19 digits (vendor id number, ledger number, etc).
Since I am new to sed, the question would be, if I don't have dashes and I need to check these cases, would this be correct to check, for instance, a 16 digit number?
sed 's/[0-9]\{16\}/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/'
Thanx. As always, I am learning so much from this website!
Giannicello
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is anyone know some scripts to generate random number without repetition using bash; for example generate 10 different random numbers.
Thanks (8 Replies)
Discussion started by: asal_email
8 Replies
2. Shell Programming and Scripting
Hello All,
I want to make a simple script which generate random number from 0 to 1000.
and simply display it.
Plz HELP!!!!!!
Regards,
Waqas Ahmed (2 Replies)
Discussion started by: wakhan
2 Replies
3. UNIX for Dummies Questions & Answers
Hi one and all,
I'm working on a Bash script that is designed to calculate how much IP traffic has passed through a port to determine traffic volume over a given amount of time.
I've currently been able to use the netstat -s command coupled with grep to write to a file the total packets... (13 Replies)
Discussion started by: nistleloy
13 Replies
4. Shell Programming and Scripting
Hi Guys I have a script to find Ranomd numbers. But I want to make the file to produce more random. Could u guys help me plz.
In this Script I have the code that generates random in for loop and the range I have specified in my %chromlength
input and out put will be like this
chrno start end... (3 Replies)
Discussion started by: repinementer
3 Replies
5. Shell Programming and Scripting
Hi,
I am having trouble with generating random numbers. can this be done with awk?
So I have a file that looks like this:
23 30
24 40
26 34
So column1 is start and column2 is end. I want to generate 3 random #'s between start and stop:
So the output will look like this:
... (9 Replies)
Discussion started by: phil_heath
9 Replies
6. Shell Programming and Scripting
Hi Can someone help me with this one?
I have string..
(PROC_PROC_ID == 12183) <--PID is dynamic
and i want to replace the PID number with whatever PID from
/opt/hpws/apache32_2/logs/httpd.pid file.
i'm having problem since the PID on the string is dynamic. It may be 2-5 digits or more.
... (5 Replies)
Discussion started by: ryandegreat25
5 Replies
7. Shell Programming and Scripting
Hi people :)
I'm learning shell scripting using bash and I want to generate 4 floating point number with 5 decimal places and write them to a file and a variable. I've done all this except the $RAMDOM enviroment variable does not generate a float number but a integrer.
I hope you could... (3 Replies)
Discussion started by: pharaoh
3 Replies
8. Shell Programming and Scripting
I have a for loop that cycles twice and generates 1 random number for each pass through. I would like to be able to store the two numbers to use later for arithmetics. Is there a way to do that? Right now I can only seem to use the last random number for anything. Thanks. (4 Replies)
Discussion started by: AxlVanDamme
4 Replies
9. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Write a shell script that will take the sum of two random number?
Ex: Random n1 +Random n2 = result
i tries to write it but i had some dufficulties
... (3 Replies)
Discussion started by: renegade755
3 Replies
LEARN ABOUT DEBIAN
algorithm::checkdigits::m16_001
CheckDigits::M16_001(3pm) User Contributed Perl Documentation CheckDigits::M16_001(3pm)
NAME
CheckDigits::M16_001 - compute check digits for ISAN
SYNOPSIS
use Algorithm::CheckDigits;
$isan = CheckDigits('isan');
if ($isan->is_valid('123A567B8912E01A')) {
# do something
}
$cn = $isan->complete('123A567B8912E01');
# $cn = '123A567B8912E01A'
$cd = $isan->checkdigit('123A567B8912E01A');
# $cd = '4'
$bn = $isan->basenumber('123A567B8912E01A');
# $bn = '123A567B8912E01'
DESCRIPTION
ALGORITHM
1. "a(1) = 16"
"b(i) = a(i) % 17 +d(i)", where d(i) is the decimal value of the hexdigit at position i.
"c(i) = b(i) % 16"
"a(i) = c(i-1) * 2", for i greater than 1
2. Beginning left for each i = 1..16, "a", "b", "c" are computed.
3. The check digit is the value for "d(16)" where "c(16)" equals 1.
4. The check digit is appended as hexadecimal value to the number.
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::M16_001(3pm)