これをもう一度整理する必要があります。
----------------------------------------------------------------
- Partition Name: testblade012 -
- Type: Shared-SMT-4 -
- Entitled Capacity: 0.30 -
----------------------------------------------------------------
以下を入力してください:
----------------------------------------------------------------
- Partition Name : testblade012 -
- Type : Shared-SMT-4 -
- Entitled Capacity : 0.30 -
----------------------------------------------------------------
答え1
のみprintf
:
while IFS=[:] read f1 f2
do
[ "$f2" ] && printf '%-40s: %-22s-\n' "$f1" "$(echo ${f2%-})" || echo "$f1"
done <<<' ----------------------------------------------------------------
- Partition Name: testblade012 -
- Type: Shared-SMT-4 -
- Entitled Capacity: 0.30 -
----------------------------------------------------------------'
またはawk
awk -F'[:]' '$2{sub(" *-$","",$2);$0=sprintf("%-40s:%-23s-",$1,$2)}1'