Sunday, May 12, 2013

Regex Recursive Syntax

Find all occurances of hostname in a file. Root Expression:
([\w\.-0-9]+company.com)(?:"|/|<)
Example:
find . -name '*.xml' -exec perl -ne '@x=m!([\w\.-0-9]+company.com)(?:"|/|<)!xsmgi;print join("\n",@x), "\n" if @x;' {} \; | sort | uniq

No comments:

Post a Comment