10-02-2001
Sed - Replacing numbers w/asteriks in random location in a file
I have a file which contains lots of text (comment field). I would like to parse through the comment field which can be up to 255 characters long and look for anything that seems to resemble, say, a credit card number or customer account number, etc. and replace the numbers with asteriks (*).
How do I do this in sed, especially if the numbers can appear anywhere in the comment field? I can do it if the numbers always appear in the same positions but this is not the case. Our users can't seem to follow directions.
I searched the faq and looked at
http://wwwinfo.cern.ch/dis/texi2html...2/sed_toc.html but it doesn't seem to have what I am looking for...
Is there a quick way with sed/awk that anyone knows of?? I prefer to do it with sed if possible.
Thank you in advance.
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 SUSE
wrjpgcom
WRJPGCOM(1) General Commands Manual WRJPGCOM(1)
NAME
wrjpgcom - insert text comments into a JPEG file
SYNOPSIS
wrjpgcom [ -replace ] [ -comment text ] [ -cfile name ] [ filename ]
DESCRIPTION
wrjpgcom reads the named JPEG/JFIF file, or the standard input if no file is named, and generates a new JPEG/JFIF file on standard output.
A comment block is added to the file.
The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. Although the standard doesn't actually define what COM blocks
are for, they are widely used to hold user-supplied text strings. This lets you add annotations, titles, index terms, etc to your JPEG
files, and later retrieve them as text. COM blocks do not interfere with the image stored in the JPEG file. The maximum size of a COM
block is 64K, but you can have as many of them as you like in one JPEG file.
wrjpgcom adds a COM block, containing text you provide, to a JPEG file. Ordinarily, the COM block is added after any existing COM blocks;
but you can delete the old COM blocks if you wish.
OPTIONS
Switch names may be abbreviated, and are not case sensitive.
-replace
Delete any existing COM blocks from the file.
-comment text
Supply text for new COM block on command line.
-cfile name
Read text for new COM block from named file.
If you have only one line of comment text to add, you can provide it on the command line with -comment. The comment text must be sur-
rounded with quotes so that it is treated as a single argument. Longer comments can be read from a text file.
If you give neither -comment nor -cfile, then wrjpgcom will read the comment text from standard input. (In this case an input image file
name MUST be supplied, so that the source JPEG file comes from somewhere else.) You can enter multiple lines, up to 64KB worth. Type an
end-of-file indicator (usually control-D) to terminate the comment text entry.
wrjpgcom will not add a COM block if the provided comment string is empty. Therefore -replace -comment "" can be used to delete all COM
blocks from a file.
EXAMPLES
Add a short comment to in.jpg, producing out.jpg:
wrjpgcom -c "View of my back yard" in.jpg > out.jpg
Attach a long comment previously stored in comment.txt:
wrjpgcom in.jpg < comment.txt > out.jpg
or equivalently
wrjpgcom -cfile comment.txt < in.jpg > out.jpg
SEE ALSO
cjpeg(1), djpeg(1), jpegtran(1), rdjpgcom(1)
AUTHOR
Independent JPEG Group
15 June 1995 WRJPGCOM(1)