-   Programming (
-   -   grep ip adress using wildcards (

masterav 07-22-2012 10:23 AM

grep ip adress using wildcards

I need to grep a ip adress from the file mentioned below using wildcards.

The ip adresss can be like this,

the number of octets vaires for each..


cat fileone

Keyboarders normally indent paragraphs three to five word spaces.based on what they were taught in school.while professionally printed material such as books and magazines generally use smaller indents.[citation needed] The Elements of Typographic Style states that "at least one en [space]" should be used to indent paragraphs after the first,[6] noting that that is the "practical minimum".[7] An em space is the most commonly used paragraph indent.[8] Miles Tinker, in his book Legibility of Print, concluded that indenting the first line of paragraphs increases readability by 7%, on the average.[9]


So my task here is that, i need to get all the ip addresses in the above paragraph...

Thanks in advance..

dmdeb 07-22-2012 10:32 AM


Originally Posted by masterav (Post 4735170)

I need to grep a ip adress from the file mentioned below using wildcards.

Hi masterav,

assuming that all IPs are given in decimal, the following line should do the job:

grep -wo "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" <filename>

See "man grep" for an explanation of -w and -o. The regular expression is a bit too tolerant (for example, it would also match "1000.0.0.0"), but that should not be a problem in practice.

Best regards

masterav 07-22-2012 10:38 AM

Thanks dmdeb

Simple and perfect..thats what i wanted,,,

Thanks you Dmdeb...:)

All times are GMT -5. The time now is 04:35 PM.