bash:files:find_replace_a_string_within_a_file
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bash:files:find_replace_a_string_within_a_file [2021/02/10 16:12] – peter | bash:files:find_replace_a_string_within_a_file [2021/02/10 16:14] (current) – [Put the output of file f1 into the pattern space of file f2] peter | ||
---|---|---|---|
Line 30: | Line 30: | ||
---- | ---- | ||
- | ===== Put the output of file f1 into the pattern space of file f2 ===== | + | ===== Put the output of file1 into the pattern space of file2 ===== |
- | <file text f1> | + | <file text file1> |
- | wjwjwjwjwjwjwj | + | aaaaaaaaaaaaaaaaaa |
- | jwjwjwjwjwjjwjw | + | aaaaaaaaaaaaaaaaaa |
- | wjwjwjwjjwjwjwj | + | aaaaaaaaaaaaaaaaaa |
</ | </ | ||
- | <file text f2> | + | <file text file2> |
Pattern_start | Pattern_start | ||
__________ //these are the line to be replaced | __________ //these are the line to be replaced | ||
Line 46: | Line 46: | ||
<code bash> | <code bash> | ||
- | sed -n '/ | + | sed -n '/ |
</ | </ | ||
Line 55: | Line 55: | ||
</ | </ | ||
+ | ---- | ||
+ | If the lines between Pattern_start and Pattern_end contain only hyphens then you can use this: | ||
+ | |||
+ | <code bash> | ||
+ | sed -n '/ | ||
+ | </ | ||
- | If the lines between Pattern_start and Pattern_end contain only hyphens then you can use this |
bash/files/find_replace_a_string_within_a_file.1612973520.txt.gz · Last modified: 2021/02/10 16:12 by peter