Skip to content

Instantly share code, notes, and snippets.

@gorvin
Last active August 29, 2018 06:56
Show Gist options
  • Save gorvin/6af9e323b4f3655c881d43bf4bcf6430 to your computer and use it in GitHub Desktop.
Save gorvin/6af9e323b4f3655c881d43bf4bcf6430 to your computer and use it in GitHub Desktop.
#!/bin/bash
### Insert a file before or after the pattern by sed
sed -e '/PATTERN/r file1' -e //N file2 # Before pattern
sed -e '/PATTERN/r file1' file2 # After pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment