hello,
I'd like to get whole 1st line (header line, makred in blue) printf in each iteration in below for loop.
What I get now is:
what to check in the awk in the loop to achieve this?:
I'd like to get whole 1st line (header line, makred in blue) printf in each iteration in below for loop.
What I get now is:
Code:
# cat inputtest
===> hostA: transfer 16/09/2016,00:00:01 - 16/09/2016,23:59:59 5 42.64
===> hostB: transfer 16/09/2016,00:00:01 - 16/09/2016,23:59:59 3 65.24
===> hostA: transfer 17/09/2016,00:00:01 - 17/09/2016,23:59:59 7 22.54
===> hostB: transfer 17/09/2016,00:00:01 - 17/09/2016,23:59:59 7 36.34
# for a in hostA hostB;do echo "---==== $a ====---";{ echo "[COLOR=#3465A4]date files size[/color]";grep $a: inputtest|tr -s ' '; } |awk -F"[ |,]" '{printf "%+11s %+10s %+10s\n",$4,$(NF-1),$NF}';echo;done
---==== hostA ====---
files size
16/09/2016 5 42.64
17/09/2016 7 22.54
---==== hostB ====---
files size
16/09/2016 3 65.24
17/09/2016 7 36.34
#
what to check in the awk in the loop to achieve this?:
Code:
---==== hostA ====---
date files size
16/09/2016 5 42.64
17/09/2016 7 22.54
---==== hostB ====---
date files size
16/09/2016 3 65.24
17/09/2016 7 36.34