![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replace string in a file w/ a variable value | tret | Shell Programming and Scripting | 5 | 12-08-2008 07:38 PM |
| numeric string and length | dragrid | Shell Programming and Scripting | 1 | 12-08-2008 12:15 PM |
| Replace spaces with 0's having numeric values. | videsh77 | Shell Programming and Scripting | 1 | 04-15-2005 02:22 AM |
| creating a fixed length output from a variable length input | r1500 | Shell Programming and Scripting | 2 | 12-03-2003 01:09 PM |
| Finding out the length of a string held within a variable | dbrundrett | Shell Programming and Scripting | 5 | 02-19-2002 08:02 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Replace variable length numeric string
I have a customer who logged some cc and bank account numbers in their apache logs. I got the cc numbers x'd out with
Code:
sed -e 's/args=[0-9]\{16\}/args=XXXXXXXXXXXXXXXX/g' -e 's/cardnum=[0-9]\{16\}/cardnum=XXXXXXXXXXXXXXXX/g'
The bank account info is different, might be 6 digits, might be 10, might be 15. The actual string in the log entry will contain Code:
args=123456789&acctnum=123456789 Now that I think about it, the new value doesn't have to match the original, meaning if it's a 7 digit value, I don't have to have 7 x's, I can replace the value, whatever the length, with say 7 or 10 x's. I'm just not sure how to identify the original variable length string. Any thoughts? |
| Bookmarks |
| Tags |
| replace, sed, variable length strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|