#!/bin/bash # # stamp-iso2oo # # Convert the first time stamp in ISO format in each line into something # less-than-ideally-intelligent software can understand. # Think OpenOffice/LibreOffice here. # Filter stdin to stdout. # Currently the ISO time stamp has to be in the 22nd century. # # ISO time stamp formats accepted (regex): # 20......[T_-] # # Copyright (C) by Volker Kuhlmann, http://volker.top.geek.nz/contact.html # All rights reserved. # Released under the terms of the GNU General Public License (GPL) Version 2. # See http://www.gnu.org/ for details. # # Volker Kuhlmann # 17, 19 Jun 2011 # globalsub="" # Replace only the first stamp. #globalsub="g" # Replace all matching stamps. export LC_ALL=C gawk ' { print \ gensub("20([0-9][0-9])([0-9][0-9])([0-9][0-9])[T_-]", "20\\1-\\2-\\3 ", "'"$globalsub"'") } '