Quote:
I tired this:
cat file.txt | sed '/^[0-9].*$/!d'
|
That says:
Match, as the only thing on the line, a single digit, followed by any number of characters.
What book or reference have you been using for BASH and scripting?
This will match an IP, but it is not perfect:
Code:
([0-9][0-9]?[0-9]?\.){3}[0-9][0-9]?[0-9]?
This is "extended regex" syntax. If used--eg--in SED, you would need the -r flag.
This works also (slightly shorter):
Code:
([0-9]([0-9]?){2}\.){3}[0-9]([0-9]?){2}