I need to insert 12spaces. It should match a particular string then go to next line with 12spaces
You can use printf
to generate spaces:
sed -e '/ath2/a\'"$(printf %012s)"'newdata' "space.txt"
Is this what you want:
sed "/ath2/a$(printf '\%12s')newdata" space