how to delete the nth occurrence of a character in a string bash shell -


i have string this: str="test,test,test,test,test,test". how can delete nth comma (,) in string str, n between 1 , 5? can give suggestion? thank you.

$ echo "$str" test,test,test,test,test,test $ sed 's/,//5' <<<"$str" #or echo "$str" |sed 's/,//5' test,test,test,test,testtest 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -