You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
354 B
Bash

#!/bin/bash
#
# Assuming the notes field of a host.cfg file is "notes\s<lat> <lon>" then print them out
files=""
while [ -n "$1" ]; do
case "$1" in
-f|--file) files="$2"; shift 2;;
*) shift 1;;
esac
done
for file in `egrep -l notes $files`; do
awk '/host_name/ {host=$2}; /notes/ {lat=$2; lon=$3} END {print host, lat, lon}' $file
done