How can one replace only the first [:space:] character in each row of a file with a \t using sed? Input: AC 12 45DC 56 89Expected output:AC    12 45DC    56 89(Something like sed  s/[:space]/'\t'/g but without affecting the other spaces in the row)
Replace selected characters
sed
To apply a substitution to only the first match on each line, you just need to remove the g (global) modifier e.g.sed 's/ /\t/' input(the POSIX class [[:space:]] is overkill for your requirement, since it includes the tab character).FYI the GNU version of sed has some additional capabilities e.g. specifying which match to substitute explicitly via a number e.g.$ sed 's/ /\t/1' inputAC      12 45DC      56 89$ sed 's/ /\t/2' inputAC 12   45DC 56   89