Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sed - Replacing numbers w/asteriks in random location in a file Post 7875 by giannicello on Tuesday 2nd of October 2001 10:00:09 PM
Old 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

Random numbers without repetition

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

Random numbers from 0 to 1000

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

Retrieving random numbers out of a text file

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

Random Numbers - Perl

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

Generating random numbers

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

Replace a random string of numbers

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

Random float numbers in BASH

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

A way to store 2 random numbers from a for loop?

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

Random numbers

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
CreditCard(3pm) 					User Contributed Perl Documentation					   CreditCard(3pm)

NAME
"Business::CreditCard" - Validate/generate credit card checksums/names SYNOPSIS
use Business::CreditCard; print validate("5276 4400 6542 1319"); print cardtype("5276 4400 6542 1319"); print generate_last_digit("5276 4400 6542 131"); Business::CreditCard is available at a CPAN site near you. DESCRIPTION
These subroutines tell you whether a credit card number is self-consistent -- whether the last digit of the number is a valid checksum for the preceding digits. The validate() subroutine returns 1 if the card number provided passes the checksum test, and 0 otherwise. The cardtype() subroutine returns a string containing the type of card. The list of possible return values is more comprehensive than it used to be, but additions are still most welcome. Possible return values are: VISA card MasterCard Discover card American Express card enRoute JCB BankCard Switch Solo China Union Pay Laser Unknown "Not a credit card" is returned on obviously invalid data values. Versions before 0.31 may also have returned "Diner's Club/Carte Blanche" (these cards are now recognized as "Discover card"). As of 0.30, cardtype() will accept a partial card masked with "x", "X', ".", "*" or "_". Only the first 2-6 digits and the length are significant; whitespace and dashes are removed. To recognize just Visa, MasterCard and Amex, you only need the first two digits; to recognize almost all cards except some Switch cards, you need the first four digits, and to recognize all cards including the remaining Switch cards, you need the first six digits. The generate_last_digit() subroutine computes and returns the last digit of the card given the preceding digits. With a 16-digit card, you provide the first 15 digits; the subroutine returns the sixteenth. This module does not tell you whether the number is on an actual card, only whether it might conceivably be on a real card. To verify whether a card is real, or whether it's been stolen, or to actually process charges, you need a Merchant account. See Business::OnlinePayment. These subroutines will also work if you provide the arguments as numbers instead of strings, e.g. "validate(5276440065421319)". PROCESSING AGREEMENTS
Credit card issuers have recently been forming agreements to process cards on other networks, in which one type of card is processed as another card type. By default, Business::CreditCard returns the type the card should be treated as in the US and Canada. You can change this to return the type the card should be treated as in a different country by setting $Business::CreditCard::Country to your two-letter country code. This is probably what you want to determine if you accept the card, or which merchant agreement it is processed through. You can also set $Business::CreditCard::Country to a false value such as the empty string to return the "base" card type. This is probably only useful for informational purposes when used along with the default type. Here are the currently known agreements: Most Diner's club is now identified as Discover. (This supercedes the earlier identification of some Diner's club cards as MasterCard inside the US and Canada.) JCB cards in the 3528-3589 range are identified as Discover inside the US and Canada. China Union Pay cards are identified as Discover cards outside China. NOTE ON INTENDED PURPOSE
This module is for verifying real world credit cards. It is NOT a pedantic implementation of the ISO 7812 standard, a general-purpose LUHN implementation, or intended for use with "creditcard-like account numbers". AUTHOR
Jon Orwant The Perl Journal and MIT Media Lab orwant@tpj.com Current maintainer is Ivan Kohler <ivan-business-creditcard@420.am>. Please don't bother Jon with emails about this module. Lee Lawrence <LeeL@aspin.co.uk>, Neale Banks <neale@lowendale.com.au> and Max Becker <Max.Becker@firstgate.com> contributed support for additional card types. Lee also contributed a working test.pl. Alexandr Ciornii <alexchorny@gmail.com> contributed code cleanups. COPYRIGHT AND LICENSE
Copyright (C) 1995,1996,1997 Jon Orwant Copyright (C) 2001-2006 Ivan Kohler Copyright (C) 2007-2009 Freeside Internet Services, Inc. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. SEE ALSO
Business::CreditCard::Object is a wrapper around Business::CreditCard providing an OO interface. Assistance integrating this into the base Business::CreditCard distribution is welcome. Business::OnlinePayment is a framework for processing online payments including modules for various payment gateways. perl v5.10.0 2009-09-28 CreditCard(3pm)
All times are GMT -4. The time now is 01:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy