Skip to content

Instantly share code, notes, and snippets.

@klashxx
Last active November 11, 2017 11:45
Show Gist options
  • Save klashxx/7dd648c72230f07cbeeedab71f687a25 to your computer and use it in GitHub Desktop.
Save klashxx/7dd648c72230f07cbeeedab71f687a25 to your computer and use it in GitHub Desktop.
awk 'FNR==1{n=$3+1;print;next}
{while(n<$3+0){
print $1",00."n",0.00000"
n++
}
print
n=$3+1}' FS=',|:' fichero
@klashxx
Copy link
Author

klashxx commented Nov 11, 2017

➜  gitx git:(dev) ✗ cat fichero
2016.10.24,00:10,1.08888
2016.10.24,00:11,1.08888
2016.10.24,00:14,1.08888
2016.10.24,00:15,1.08888
2016.10.24,00:21,1.08888
➜  gitx git:(dev) ✗ 
➜  gitx git:(dev) ✗ awk  'FNR==1{n=$3+1;print;next}{c=$3;while(n<c){print $1",00."n",0.00000";n++}print;n=$3+1}' FS=',|:' fichero
2016.10.24,00:10,1.08888
2016.10.24,00:11,1.08888
2016.10.24,00.12,0.00000
2016.10.24,00.13,0.00000
2016.10.24,00:14,1.08888
2016.10.24,00:15,1.08888
2016.10.24,00.16,0.00000
2016.10.24,00.17,0.00000
2016.10.24,00.18,0.00000
2016.10.24,00.19,0.00000
2016.10.24,00.20,0.00000
2016.10.24,00:21,1.08888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment