linux - Need to filter out valid IP addresses using regex -


i have radius client configuration file in /etc/raddb/server in want valid ip address without commented line,so i'm using

grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /etc/raddb/server 127.0.0.1 192.168.0.147 

but want ignore 127.0.0.1 commented # how stuff??

/etc/raddb/server file follow

cat /etc/raddb/server  #  pam_radius_auth configuration file.  copy to: /etc/raddb/server # #  proper security, file should have permissions 0600, #  readable root, , no 1 else.  if other #  root can read file, can spoof responses server! # #  there 3 fields per line in file.  there may multiple #  lines.  blank lines or lines beginning '#' treated #  comments, , ignored.  fields are: # #  server[:port] secret [timeout] # #  port name or number optional.  default port name #  "radius", , looked /etc/services timeout field #  optional.  default timeout 3 seconds. # #  if multiple radius server lines exist, tried in order.  #  first server return success or failure causes module return #  success or failure.  if server fails response skipped, #  , next server in turn used. # #  timeout field controls how many seconds module waits before #  deciding server has failed respond. # # server[:port] shared_secret      timeout (s) #127.0.0.1      secret             1 #other-server    other-secret       3 192.168.0.147:1812    testing123           1 # # having localhost in radius configuration thing. # # see install file pam.conf hints. 

try grep -o '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /etc/raddb/server


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -