|
|
@ -1,4 +1,4 @@
|
|
|
|
#! /bin/bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# An example script that converts messages in a syslog file into a
|
|
|
|
# An example script that converts messages in a syslog file into a
|
|
|
@ -20,16 +20,16 @@ if test $# -lt 1; then
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if test ! -f $1; then
|
|
|
|
if test ! -f "$1"; then
|
|
|
|
echo "error: expecting a log file as the first argument"
|
|
|
|
echo "error: expecting a log file as the first argument"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Figure out a unique file name.
|
|
|
|
# Figure out a unique file name.
|
|
|
|
out_file_base="$(basename $1)"
|
|
|
|
out_file_base=$(basename "$1")
|
|
|
|
counter=0
|
|
|
|
counter=0
|
|
|
|
while test -e "${out_file_base}.${counter}.csv"; do
|
|
|
|
while test -e "${out_file_base}.${counter}.csv"; do
|
|
|
|
counter=`expr ${counter} + 1`
|
|
|
|
counter=$((counter + 1))
|
|
|
|
done
|
|
|
|
done
|
|
|
|
export OUT_FILE="${out_file_base}.${counter}.csv"
|
|
|
|
export OUT_FILE="${out_file_base}.${counter}.csv"
|
|
|
|
|
|
|
|
|
|
|
@ -63,4 +63,4 @@ lnav -nq -d /tmp/lnav.err \
|
|
|
|
SELECT start_line FROM helper) and (SELECT max_line FROM helper)" \
|
|
|
|
SELECT start_line FROM helper) and (SELECT max_line FROM helper)" \
|
|
|
|
-c ':write-csv-to $OUT_FILE' \
|
|
|
|
-c ':write-csv-to $OUT_FILE' \
|
|
|
|
-c ":save-session" \
|
|
|
|
-c ":save-session" \
|
|
|
|
$1
|
|
|
|
"$1"
|
|
|
|