forensics grep regular expressions
(credit cards, IP, e-mail addresses, IBAN)

The following regular expressions were tested on Gentoo x64

  • Search for credit card numbers

grep -E ‘(^|[[:space:]])[456][[:digit:]]{3}((-|[[:space:]])?[[:digit:]]{4}){3}([[:space:]]|$)’ <filename>

  • Search for IP addresses

# grep -E ‘(^|[[:space:]])[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}([[:space:]]|$)’ <filename>

  • Search for e-mail addresses

# grep -E ‘(^|[[:space:]])[[:alnum:]]{1,}@[[:alnum:]]{2,}\.[[:alpha:]]{2,6}([[:space:]]|$)’ <filename>

  • Search for IBAN

grep -E ‘(^|[[:space:]])[A-Z]{2}[[:digit:]]{2}((-|[[:space:]])[[:alnum:]]{4}){3}’ <filename>

if anybody can give me something less ugly please post it here