# gawk (and recent versions of mawk) have a built-in [time/date # function][1], so there is no need to use external tools there. gawk '/Hello/{print NR " - " $0 " - " strftime("%Y-%m-%d")}' party.txt # [1]: http://www.gnu.org/software/gawk/manual/html_node/Time- # Functions.html # # [Alin] [so/q/12366995] [cc by-sa 3.0] $Follow @igor_chubin cheat.sh