There are 2 tasks: numerate apropriate line(s) than format output:
nl -bp[A-Z] -nln abc.txt |
sed '/^\w/{s/\(.*\)\(....\)/\2 \1/
n
N
s/\n\s*/ /
}
s/^\s*//
' > xyz.txt
There are 2 tasks: numerate apropriate line(s) than format output:
nl -bp[A-Z] -nln abc.txt |
sed '/^\w/{s/\(.*\)\(....\)/\2 \1/
n
N
s/\n\s*/ /
}
s/^\s*//
' > xyz.txt