The asterisk (*) means “zero or more of the previous item”.
If you want to match any single character use
sed -i 's/string-./string-0/g' file.txt
If you want to match any string (i.e. any single character zero or more times) use
sed -i 's/string-.*/string-0/g' file.txt
More Related Contents:
- How can I manipulate text in bash? [closed]
- How can I do a recursive find/replace of a string with awk or sed?
- Bash tool to get nth line from a file
- Stop shell wildcard character expansion?
- How to merge every two lines into one from the command line?
- sed search and replace strings containing / [duplicate]
- In bash, how do I expand a wildcard while it’s inside double quotes?
- Recursively rename files using find and sed
- Error when using ‘sed’ with ‘find’ command on OS X: “invalid command code .”
- How to skip the for loop when there are no matching files?
- Remove Unicode characters from textfiles – sed , other Bash/shell methods
- How to replace an entire line in a text file by line number
- Using sed to mass rename files
- What do double-asterisk (**) wildcards mean?
- List files not matching a pattern?
- How do I escape slashes and double and single quotes in sed?
- How to use a bash script variable with sed [duplicate]
- Error with sed unterminated s command in bash
- What does the double-asterisk (**) wildcard mean?
- Use sed to replace all backslashes with forward slashes
- Escaping forward slashes in sed command [duplicate]
- Convert line endings [duplicate]
- sed multiline delete with pattern
- Getting “sed error – illegal byte sequence” (in bash) [duplicate]
- Extract version number from a string
- how to delete the duplicate lines in file except the first matched line
- How to insert a new line character after a fixed number of characters in a file
- How to append a string at end of a specific line in a file in bash [duplicate]
- Loop over array, preventing wildcard expansion (*)
- How to delete rows from a csv file based on a list values from another file?