I have a bash script:
#!/bin/bash
gawk -f realmap.awk realmap.log | column -ts: > realmap.csv
gnuplot <<-_EOF_
set term png
set out 'realmap.png'
set xlabel 'index'
set ylabel 'bytes'
set style data lp
plot 'realmap.csv' u 1:2 t col, '' u 1:3 t col, '' u 1:4 t col, '' u 1:5 t col, '' u 1:6 t col, '' u 1:7 t col
_EOF_
rm realmap.csv
display realmap.png
And a awk script:
#!/usr/bin/gawk -f
BEGIN{
printf("%s:%s:%s:%s:%s:%s:%s\n", "index", "total", "used", "free", "cached", "buffers", "cache")
}
/^#/{
gsub("#", "")
printf("%d:", $0+1)
}
/^M/{
printf("%d:%d:%d:%d:", $2,$3,$4,$7)
}
/^-/{
printf("%d:%d\n", $3, $4)
}
How to combine these two scripts as one?