At 11:43 AM 10/29/2003 -0600, Andrew Gaffney wrote:
Rick Bragg wrote:Hi,
I want to write a script that will test the contents of a file.
The file being tested will pass only if it contains nothing more than an ip address on one line. Does anyone have a sample of a simple regex to accomplish this?
/\d+\.\d+\.\d+\.\d+\n?/s
Slightly more complex and slightly more robust:
cat <<EOF | perl -lne "print if /^(\d{1,3}\.){3}\d{1,3}$/" hello 1.2.3.4.5 1.2.3 1.2.3.4 1.2.3.4 hello hello 1.2.3.4 123.123.123.123 1234.123.123.123 EOF
Regards, - Robert
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]