Ask Your Question
0

How can I find and replace data with mask data in calc? ie Phone number masking last 4 digits.

asked 2017-03-21 21:33:12 +0200

Capt'n Kirk gravatar image

updated 2017-03-21 21:41:49 +0200

I have a list of contacts I need to pass on to a private individual and I do not want to reveal all the information as it could be used inappropriately if it leaves my control.

I am trying to prove I have a large contact list but mask out some of the data such as partial phone numbers, email addresses, last names and addresses. Just to show enough information to prove it exists (so it doesn't look like its a created out of nothing list) but not enough it could be copied and used to someone else's benefit.

There's thousands of lines in a CSV spreadsheet. Only have a few columns. So if I need to make a custom script or something for each criteria, that's okay.

In my example: Columns are: Comapny,FirstName,LastName,Address,City,Phone,EmailAddress,Website

And since a lot of the list is not companies and are private individuals, it further increases my need to mask information.

A Company Name John Doe 1234 Some Street Address In-A-City 555-555-5555 an-email-address@someserver.something www.websiteaddress.domain

I would want to partially mask some of the information with x's and truncations.

Replace the last name like Dxx Replace the address with a truncation like 1234 Some... Replace the phone number with 555-555-xxxx Replacing and truncation of an email address with ad....s@somese... Replacing the website address with a truncation like www.webs...

Thanks muchly!!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-03-22 06:55:30 +0200

updated 2017-03-22 07:01:15 +0200

I'd use regular expressions and replacer in columns (selection only).

For last name, I'd search for (\b[[:alpha:]]x*)[^x ]([^ ]*)$ and replaced with $1x$2 until no more occurrences are found in the column. (This replaces one character in last name with x each time.)

For phone numbers, I'd use ([[:digit:]]{3}-[[:digit:]]{3}-)[[:digit:]]{4} and replaced with $1xxxx.

Addresses: ^(.{9}).*$ -> $1...

Emails: ^(..).*(.@.{6}).*$ -> $1...$2... (this ignores the count of characters in email, just replaces any count of characters with ellipsis).

Websites: ^(.{8}).*$ -> $1...

And, of course, check the data manually afterwards, to make sure that everything is as you need. No advise here has any kind of guarantee, so using anything is your own risk. No responsibility taken.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2017-03-21 21:33:12 +0200

Seen: 169 times

Last updated: Mar 22 '17