Hi,
I got a very unexpected result while using grep. I have 3 files with
IP and dns pairings. file 1, 2 and 3. If I use "grep [[:alpha:]] 1" I
get the expected results, all the IP addresses with their host name.
However, if I use "grep [[:digit:]] 1" I get all IP's from all 3
files. I actually found this by using the -c to count the number of IP
addresses. Much to my surprise I got the results of all 3 files.
File content.
file 1:
----------------------------------------
10.0.0.101 usera
10.0.0.102
10.0.0.103 userb
10.0.0.105
10.0.0.106
10.0.0.110
10.0.0.111 userc
10.0.0.112 userd
10.0.0.113 usere
----------------------------------------
file 2:
----------------------------------------
10.0.0.101 usera
10.0.0.102
10.0.0.103 userb
10.0.0.105
10.0.0.106
10.0.0.110
10.0.0.111 userc
10.0.0.112 userd
10.0.0.113 usere
----------------------------------------
file 3:
----------------------------------------
10.0.1.102
10.0.1.103 usera
10.0.1.106
10.0.1.107 userb
10.0.1.109 userc
10.0.1.114
10.0.1.115
10.0.1.118 userd
10.0.1.120 usere
----------------------------------------
Command usage and output:
user:user>grep -c [[:alpha:]] 1
5
user:user>grep -c [[:digit:]] 1
2:9
3:9
1:9
Regards,
--
Mike Hahn
Flex-N-Gate Michigan, LLC.
Voice: 586.439.4026
Fax: 586.773.0054
Cell: 586.709.2385
[1][email protected]
References
1. mailto:[email protected]