Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sed - Replacing numbers w/asteriks in random location in a file Post 7950 by giannicello on Wednesday 3rd of October 2001 11:20:18 PM
Old 10-04-2001
dEvNuL, I have to give you credit for doing research. Thanks again.

I would mention one thing I found out about having the regexp all in one file -- the order is very important. I have to work with the longest numbers first to strike those out and then work with the second longest, etc. If I start out with 13 digits, part of the 19 or 16 digits gets strucked first (*) which means that the 16 digits/19 digit pattern search no longer finds a match... :-(

I ran this against a page of credit card number and it was instanteous. I don't think it will take long to process even 50 pages...


Giannicello
PS dEvNuL will be rightfully credited in my batch jobs.
 

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
Regexp::Common::CC(3pm) 				User Contributed Perl Documentation				   Regexp::Common::CC(3pm)

NAME
Regexp::Common::CC -- provide patterns for credit card numbers. SYNOPSIS
use Regexp::Common qw /CC/; while (<>) { /^$RE{CC}{Mastercard}$/ and print "Mastercard card number "; } DESCRIPTION
Please consult the manual of Regexp::Common for a general description of the works of this interface. Do not use this module directly, but load it via Regexp::Common. This module offers patterns for credit card numbers of several major credit card types. Currently, the supported cards are: Mastercard, Amex, Diners Club, and Discover. SEE ALSO
Regexp::Common for a general description of how to use this interface. <http://www.beachnet.com/~hstiles/cardtype.html> Credit Card Validation - Check Digits <http://euro.ecom.cmu.edu/resources/elibrary/everycc.htm> Everything you ever wanted to know about CC's <http://www.webopedia.com/TERM/L/Luhn_formula.html> Luhn formula AUTHORS
Damian Conway (damian@conway.org) and Abigail (regexp-common@abigail.be). MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be). BUGS AND IRRITATIONS
Bound to be plenty. Send them in to regexp-common@abigail.be. LICENSE and COPYRIGHT This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail. This module is free software, and maybe used under any of the following licenses: 1) The Perl Artistic License. See the file COPYRIGHT.AL. 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. 3) The BSD Licence. See the file COPYRIGHT.BSD. 4) The MIT Licence. See the file COPYRIGHT.MIT. perl v5.14.2 2010-02-23 Regexp::Common::CC(3pm)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy