#!/bin/bash file="$1" if [[ "X" == "X${file}" ]] then file="${HISTFILE}" fi prev="" cat ${file} | while read line do mtch=$(echo ${line} | grep '^#[0-9]') # echo "DEBUG: line:[${line}] mtch:[${mtch}]" if [[ "X" == "X${mtch}" ]] then if [[ "X" != "X{${prev}" ]] then echo "${prev}" fi prev="${line}" else tmp=$(echo ${line} | sed 's/#//') # echo "MATCHED DEBUG: line:[${line}] tmp:[${tmp}]" dt=$(date -d "1970-01-01 ${tmp} sec UTC") echo -n "[${dt}]> ${prev}" prev="" fi done