hi everybody
I am a new user to this forum and its previous posts have been very useful. I'm searching in a file using grep for patterns like
12.13.444
55.44.443
i.e. of form
<digit><digit>.<digit><digit>.<digit><digit><digit>
Can anybody help me with this.
Thanks in advance
grep -e '^[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9]$'
Or, if you have a better version of grep than I have:
grep '^([0-9]{2}\.){2}[0-9]{3}$'
hi
actually the pattern is in middle of the line and not at the beginning or at end.
so i tried the following options:
- grep -e '[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9][0-9]' file1
o/p : also gave lines with patterns as 1116.20.233
- grep '([0-9]{2}\.){2}[0-9]{3}' file1
o/p : no output
format of file1 is
HPOvBbc=06.20.050
HPOvConf=06.20.050
HPOvCtrl=06.20.052
HPOvDepl=06.20.051
HPOvSecCC=06.20.050
HPOvSecCo=06.20.050
HPOvPCO=11510.50.180
HPOvPacc=11610.50.180
HPOvEaAgt=11708.60.005
HPOvEaAes=11808.60.005
HPOvEaAja=01198.60.005
Yeah, when you took off the ^ it would have opened up the regexp too much.
Leave the $ on the end and replace the ^ at the start with \=
Should sort it.