This is what I have:
echo -e "a\t4\nb\t7\nc\t2\nd\t12\n" | sed -rn 's/(.*)\t([0-9]*)$/\2\t\1\1\1\t/p'
4 aaa
7 bbb
2 ccc
12 ddd
This I want:
4 aaaa
7 bbbbbbb
2 cc
12 dddddddddddd
Is this possible in sed only or I have to use some other tools?
Not really totally pure
sed
, but rather with setting the flage
which allows for embedding shell commands and executing them and allows for risky command injection as well so know that one and do (if you have to) on your own risk.Not really my preferred way either but you asked for it.
That said, you can do it with something like this: