Advertisement
RobsonAlexandre

Configura Nagios Hostextinfo Coords

Nov 4th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 0 0
  1. #!/bin/bash
  2. arqA=/tmp/arquivoA
  3. arqB=/tmp/arquivoB
  4. clear
  5. while read linha
  6. do
  7. coords=( $(sed 's/,/ /g' <<< $linha) )
  8. sed -r -i ":a;/}/!{N;ba}; /${coords[0]}/s/(.*2d_coords )(.*)(\n.*)/\1${coords[1]},${coords[2]}\3/g" ${arqB}
  9. done < ${arqA}
  10.  
  11.  
  12. #Resultando na saída
  13. #define hostextinfo{
  14. #host_name server1
  15. #2d_coords 133,809
  16. #}
  17. #
  18. #define hostextinfo{
  19. #host_name server_ad01
  20. #2d_coords 297,1108
  21. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement