Created
August 4, 2023 18:07
-
-
Save liweinan/0273f4b3e41ba6a9ea157153b9587a2f to your computer and use it in GitHub Desktop.
Using `sed` to add contents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weli@192:/tmp | |
➤ cat foo.txt 02:05:38 | |
abc | |
def | |
weli@192:/tmp | |
➤ vi foo.txt 02:05:41 | |
weli@192:/tmp | |
➤ sed -e 's/def/xyz/' foo.txt 02:05:48 | |
abc | |
xyz | |
weli@192:/tmp | |
➤ sed -e 's/def/xyz\n/' foo.txt 02:05:51 | |
abc | |
xyz | |
weli@192:/tmp | |
➤ sed -e 's/def/xyz\ndef/' foo.txt 02:05:55 | |
abc | |
xyz | |
def | |
weli@192:/tmp | |
➤ 02:06:08 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment