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
Post a Comment