Last active
April 8, 2019 10:13
-
-
Save lwl5219/c07848be6761da100e3bcb1f803656be to your computer and use it in GitHub Desktop.
[Useful bash commands] #cmd
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
##### Use the contents of a file to replace a string using SED | |
# You can use the `r` command. | |
# Reference: https://stackoverflow.com/a/6790967/1673077 | |
# Example: use the contents of fileA.txt to replace the line that contains 'china' in fileB.txt | |
sed -i -e '/china/{r fileA.txt' -e 'd' -e '}' fileB.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment