I want Shell script to find my Orignal_literal and change it with dynamic literal, this literal would be runtime input to script.
Asked
Active
Viewed 5,671 times
1 Answers
0
sed -i "s/Orignal_literal/c \\$variable/g" file.txt
Explanation:
sed= Stream Editor-i= In-place (i.e. save back to the original file)- The command string:
s: The substitute commandOrignal_literal: A regular expression describing the word to replace (or just the word itself)g: Global (i.e. replace all and not just the first occurrence)variable: Runtime variablefile.txt: The file name
-
2What's the `c\\ ` for? – tripleee Jun 30 '18 at 21:13