Skip to content

Instantly share code, notes, and snippets.

@jkramer
Created July 9, 2015 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkramer/20ba9f1323988e2dd1af to your computer and use it in GitHub Desktop.
Save jkramer/20ba9f1323988e2dd1af to your computer and use it in GitHub Desktop.
gawk caches output of shell commands
[jkramer/mk-17:~]# <foo.awk
BEGIN {
for(i = 0; i < 5; i++) {
"date +%s" | getline sec
print sec
system("sleep 1")
}
}
[jkramer/mk-17:~]# gawk -f foo.awk
1436437135
1436437135
1436437135
1436437135
1436437135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment