<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sed - masking credit card numbers in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303594#M495740</link>
    <description>Hi Gary:&lt;BR /&gt;&lt;BR /&gt;I prefer Perl since it probably has the most robust regular expressions available:&lt;BR /&gt;&lt;BR /&gt;# perl -pe 's/\b(45\d\d)(\d{8})(\d{4})\b/$1\*\*\*\*\*\*\*\*$3/g' file&lt;BR /&gt;&lt;BR /&gt;This will look for 16-digit numbers beginning with "45" and bounded by word "boundry" (\b) characters (e.g. whitespace) on either end.  A '\d' is any digit.  We escape the "*" to avoid special meaning.  The '{n}' is a shorthand for the number of repetitions.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 10 Nov 2008 21:52:17 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2008-11-10T21:52:17Z</dc:date>
    <item>
      <title>sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303593#M495739</link>
      <description>Hi,&lt;BR /&gt;   I'm hoping someone can help me with a sed statement (or if sed is even appropriate for this). I have a bunch of log files that have credit card numbers in them, and I need to mask the credit card numbers. All the credit cards are 16 digits and start with a 4 or 5. I want to replace the middle 8 digits with an asterisk (*). I've tried a number of things, but haven't been able to get it to work. Can someone please help me out? Thanks for any help or pointers in the right direction.</description>
      <pubDate>Mon, 10 Nov 2008 21:25:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303593#M495739</guid>
      <dc:creator>Gary Hines</dc:creator>
      <dc:date>2008-11-10T21:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303594#M495740</link>
      <description>Hi Gary:&lt;BR /&gt;&lt;BR /&gt;I prefer Perl since it probably has the most robust regular expressions available:&lt;BR /&gt;&lt;BR /&gt;# perl -pe 's/\b(45\d\d)(\d{8})(\d{4})\b/$1\*\*\*\*\*\*\*\*$3/g' file&lt;BR /&gt;&lt;BR /&gt;This will look for 16-digit numbers beginning with "45" and bounded by word "boundry" (\b) characters (e.g. whitespace) on either end.  A '\d' is any digit.  We escape the "*" to avoid special meaning.  The '{n}' is a shorthand for the number of repetitions.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 10 Nov 2008 21:52:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303594#M495740</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-11-10T21:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303595#M495741</link>
      <description>It might be easier to suggest something&lt;BR /&gt;useful if you provided a sample of the data&lt;BR /&gt;to be mutilated.</description>
      <pubDate>Mon, 10 Nov 2008 23:01:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303595#M495741</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-11-10T23:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303596#M495742</link>
      <description>Here is something similar with sed:&lt;BR /&gt;sed -e 's/\([45][0-9]\{3\}\)[0-9]\{8\}\([0-9]\{4\}\)/\1********\2/' file&lt;BR /&gt;&lt;BR /&gt;This will replace any 16 digit string that starts with 4 or 5.  Even if embedded in a longer digit string.  If we need to disallow that, we can add delimiters at the beginning and end.</description>
      <pubDate>Mon, 10 Nov 2008 23:02:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303596#M495742</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-11-10T23:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303597#M495743</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;With awk also you can do the same&lt;BR /&gt;awk '{ if (substr($0,1,2)=="45") printf "%s********%s\n",substr($0,1,4),substr($0,12,4) }'&lt;INPUTFILE&gt;outputfile&lt;BR /&gt;&lt;BR /&gt;Suraj&lt;/INPUTFILE&gt;</description>
      <pubDate>Tue, 11 Nov 2008 05:38:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303597#M495743</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2008-11-11T05:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303598#M495744</link>
      <description>Hi Again,&lt;BR /&gt;&lt;BR /&gt;Or you can use this also&lt;BR /&gt;&lt;BR /&gt;awk '{ if (substr($0,1,2)=="45") printf "%s********%s\n",substr($0,1,4),substr($0,12,4)&lt;BR /&gt;        else print $0&lt;BR /&gt;     }'&lt;O&gt;&lt;/O&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Tue, 11 Nov 2008 05:45:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303598#M495744</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2008-11-11T05:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303599#M495745</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Allow me to point out the obvious.&lt;BR /&gt;&lt;BR /&gt;Credit card numbers should NEVER exist in clear text on a Unix or Linux system.&lt;BR /&gt;&lt;BR /&gt;They should always be in a secure database, with encrypted access.&lt;BR /&gt;&lt;BR /&gt;The fact you are even trying this scares the hell out of me.&lt;BR /&gt;&lt;BR /&gt;Good luck with the sed command, you got good answers.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 11 Nov 2008 08:35:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303599#M495745</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-11-11T08:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303600#M495746</link>
      <description>To add to Stevens comment:&lt;BR /&gt;&lt;BR /&gt;I wonder about the legality of keeping credit card numbers in plain text.&lt;BR /&gt;&lt;BR /&gt;Do a google search and you'll find plenty of information regarding the legal requirements for storing different types of data....the complexity of the information is huge.&lt;BR /&gt;&lt;BR /&gt;To make your life easier contact your Storage Manager and your companies legal department for guidance on how you should store the credit card information.&lt;BR /&gt;&lt;BR /&gt;Without knowing your architecture I have to assume you're not in a good legal position right now.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Noticed in your profile you're in the US.&lt;BR /&gt;Found this link which may assist you&lt;BR /&gt;&lt;A href="http://www.cit.cornell.edu/security/requirements/secreqs-confidentialdata.html" target="_blank"&gt;http://www.cit.cornell.edu/security/requirements/secreqs-confidentialdata.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;In that link is another link to &lt;A href="https://www.pcisecuritystandards.org/" target="_blank"&gt;https://www.pcisecuritystandards.org/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;They look like good starting points to find out your legal requirements for storing the credit card data.</description>
      <pubDate>Tue, 11 Nov 2008 12:24:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303600#M495746</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-11-11T12:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303601#M495747</link>
      <description>We found this problem during an internal security audit in which an older portion of code had been used incorrectly. That has been fixed, and we are erasing all the older log files. I wanted to keep the last two weeks of logs for problem tracking, and so the request for help on the sed statement to mask the numbers. Other than this occurrence, all the numbers are kept in encrypted files/columns.</description>
      <pubDate>Tue, 11 Nov 2008 13:17:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/4303601#M495747</guid>
      <dc:creator>Gary Hines</dc:creator>
      <dc:date>2008-11-11T13:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7020317#M495748</link>
      <description>&lt;P&gt;HOW TO RESTRICT ONLY 16 DIGITS AND ONLY number?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 19:43:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7020317#M495748</guid>
      <dc:creator>FAZILUDDIN</dc:creator>
      <dc:date>2018-10-02T19:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7020320#M495749</link>
      <description>&lt;P&gt;Please assist me in regex to mask middle 8 digits of 16 digits card number in linux? Any one can help on this will be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 20:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7020320#M495749</guid>
      <dc:creator>FAZILUDDIN</dc:creator>
      <dc:date>2018-10-02T20:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: sed - masking credit card numbers</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7021071#M495750</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/1940134"&gt;@FAZILUDDIN&lt;/a&gt;&amp;gt; regex to mask middle 8 digits of 16 digits card number&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Assuming you have already extracted the number or only strings with &amp;gt;= 16 digits are credit card numbers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is similar to my reply to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.hpe.com/t5/Languages-and-Scripting/sed-masking-credit-card-numbers/m-p/7020320#U4303596" target="_blank"&gt;https://community.hpe.com/t5/Languages-and-Scripting/sed-masking-credit-card-numbers/m-p/7020320#U4303596&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sed -e 's/\([0-9]\{4\}\)[0-9]\{8\}\([0-9]\{4\}\)/\1********\2/' file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Keeps first and last 4.&amp;nbsp; Replaces middle 8 by "*".&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 05:44:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-masking-credit-card-numbers/m-p/7021071#M495750</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2018-10-09T05:44:21Z</dc:date>
    </item>
  </channel>
</rss>

