linux - Replace first space with other string in file with Bash script -


For example, I have a string like "Test Test Test" in a file, to create a "1 Test Test Test" I want to replace the first place with '1'

I tried sed -i "s / ^ \ / \ 1 \ / g" on text .txt , it will convert all the spaces to '1', so I would like to know how to make it only after getting it first?

do not use the option 'g' in this way (global replacement) :

  sed 's / 1 /'    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -