Created
April 22, 2015 18:39
-
-
Save flandr/082c6453ec97b4e3ed7f to your computer and use it in GitHub Desktop.
awk ternary example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data: | |
# 1ms foo | |
# 3.7s bar | |
# ... | |
# Convert to seconds | |
gawk 'BEGIN {FS=" +"} { val = $1 ~ /ms$/ ? $1 / 1000 : $1 * 1; print val,$2 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment