For each token in this file:
Al+nHr Al+ErAqy syAsy lA TA}fy
Al+ArbEA' $wAl
I hope to get this:
AlnHr Al+nHr
AlErAqy Al+ErAqy
syAsy syAsy
lA lA
TA}fy TA}fy
AlArbEA' Al+ArbEA'
$wAl $wAl
So I want have this format in each line:
<token with no +><space><original token>
Is there an easy one line sed to do that?
Thanks!
When applying the same transformations to a varying number of fields in a line, I find awk easier to use than sed. I'm also not a big fan of one liners when it is much easier to read and understand formatted code. The following script seems to do what you want:
awk '{ for(i=1; i<=NF; i++) {
x = $i
gsub(/[+]/, "", x)
printf("%s %s\n", x, $i)
}
}' input
and if you insist on a one-line solution, the following is equivalent:
awk '{for(i=1;i<=NF;i++){x=$i;gsub(/[+]/,"",x);printf("%s %s\n",x,$i)}}' input