이것을 다시 정리해야 합니다.
----------------------------------------------------------------
- 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'