View Single Post
Old 02-20-2017, 12:36 PM   #35
Yourcat
Groupie
Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.Yourcat knows the way to San Jose.
 
Posts: 175
Karma: 54048
Join Date: Mar 2016
Device: PW3 5.6.5-usbnet
Sorry, I overlooked your use of multiple quotes. I didn't test it on my Kindle but hopefully the one or the other command works there:
cat /tmp/messages | awk -v date="$(date +%X | cut -d':' -f-2)" '/^[0-9:]++ [a-z]++.[0-9]++.: I [a-zA-Z]++:[a-zA-Z]++PageTurnAction|Foo)/ {system("echo ffff "date)}'


Using strftime my awk version returns the 24h format while gawk works fine.
cat /tmp/messages | awk '/^[0-9:]++ [a-z]++.[0-9]+.: I [a-zA-Z]++:[a-zA-Z]++PageTurnAction|Foo)/ {date=substr(strftime("%X"),0,5); system("echo ffff "date)}'

You should really optimize the expressions to avoid backtracking - with your expression this may happen 4 times for each character in every line if the line does not match.
http://stackoverflow.com/questions/3...tomic-grouping is interesting.
Yourcat is offline   Reply With Quote