print first line unconditionally
print first line unconditionally
(OP)
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 --> shell
# 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 "date files size";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 --> output
---==== 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
RE: print first line unconditionally
CODE --> solution