FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
appendix:sed.html [2018/02/02 00:32] kurihara created |
appendix:sed.html [2020/02/28 23:14] (current) kurihara [Insert row] |
||
---|---|---|---|
Line 10: | Line 10: | ||
+ | \\ | ||
+ | \\ | ||
===== Example ===== | ===== Example ===== | ||
- | ==== Line Delete ==== | + | ==== Delete |
<sxh bash toolbar: | <sxh bash toolbar: | ||
Line 28: | Line 29: | ||
</ | </ | ||
- | ==== Line Append ==== | + | \\ |
+ | ==== Append | ||
+ | <sxh bash toolbar: | ||
+ | $ cat test.txt | ||
+ | 123 | ||
+ | 456 | ||
+ | abc | ||
+ | def | ||
+ | $ cat test.txt | sed -e "/ | ||
+ | 123 | ||
+ | 456 | ||
+ | 789 | ||
+ | abc | ||
+ | def | ||
+ | </ | ||
+ | |||
+ | |||
+ | \\ | ||
+ | ==== Insert row==== | ||
+ | <sxh bash toolbar: | ||
+ | $ cat test.txt | ||
+ | 123ab | ||
+ | 456ab | ||
+ | abcab | ||
+ | defab | ||
+ | $ cat test.txt | sed -e "/ | ||
+ | 123ab | ||
+ | aaa | ||
+ | 456ab | ||
+ | abcab | ||
+ | defab | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | ==== Substitution ==== | ||
+ | <sxh bash toolbar: | ||
+ | $ cat test.txt | ||
+ | 123 | ||
+ | 456 | ||
+ | abc | ||
+ | def | ||
+ | $ cat test.txt | sed ' | ||
+ | 123 | ||
+ | 789 | ||
+ | abc | ||
+ | def | ||
+ | </ | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ cat test.txt | ||
+ | Defaults | ||
+ | $ cat test.txt |sed ' | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | === Replace if matched=== | ||
+ | <sxh bash toolbar: | ||
+ | sed -i '/ | ||
+ | </ | ||
- | ==== Line Insert | + | \\ |
+ | ==== Reuse ==== | ||
+ | If it is enclosed by \(target character string \), it is partially reused such as \1, \2, \3, ... of the replaced character string | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.