awk :
awk 'BEGIN{ FS=OFS="|" }{ cs=$2$3$4; gsub(/ +/, " ", cs); print $1,sprintf("%-32s",cs),$5 }' abc.txt
-
FS=OFS="|"
- separador de campos -
cs=$2$3$4
- campo 2, 3 e 4 concatenado -
gsub(/ +/, " ", cs)
- removendo espaços redundantes -
sprintf("%32s",cs)
- string concatenada formatada
A saída:
ID|first namemiddle namelast name |address
1 | john whatever smith | somewhere