I have a small problem with the syntax of sed in a script.
I just want it to search for a string in a specific file and replace only a part of the string.
Line in the script:
Code:
sed s/NAME="*"/NAME=John/ names.txt > names2.txt
The line I want to modify:
NAME=Peter
The resulting line:
NAME=JohnPeter
Alternative lines I have tried without success:
Code:
sed s/"NAME="*""/NAME="John"/ names.txt > names2.txt
Code:
sed s/"NAME="*""/"NAME=John"/ names.txt > names2.txt
Any ideas?
SOLVED:
I hadn't noticed that I missed a "." in ".*". Now it works.
I'm new to this forum so I don't know how to remove the post. Sorry.