shell - how to replace line bash script -
I want to change a line of text in a file. This is not a specific line #, but matches a certain parameter and then replaces the whole line as I want.
There is an idea in search of 'sed', the problem contains all the special characters in the source / to replace those stars which are confusing me how to handle properly I have also tried it That these are parsed variables but there are no results.
Example: To match the source line: PATH_FLOW = * doing anything *
to be replaced with: PATH_FLOW = "file: /// var / Etc / Sysconfig / random_file
sed -i 's / ^ PATH_FLOW = * / PATH_FLOW = "file: /// var / log" / g / / Code>
You can use it like this:
Sed -i.bak '/PATH_FLOW=/s~^.*$ ~ PATH_FLOW = "file: /// var / log" ~'
Comments
Post a Comment