Last active
December 9, 2017 09:34
-
-
Save ronamosa/519d255362352f48d925a771486c2026 to your computer and use it in GitHub Desktop.
handy command line snippets
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
# description: | |
# inserts a new field after an existing field in a yaml file | |
# scenario: | |
# needed to add "comments: true" to all my github page blog posts (*.md) | |
# explain: | |
# -i = edit file in place | |
# -e = regex | |
# 's = substitute | |
# find this "/published\:\ true/" | |
# replace with this "/published\:\ true/" | |
# plus "\ncomments\:\ true/" (note the new line '\n' | |
# do this all files that match ".md" | |
sed -i -e 's/published\:\ true/published\:\ true\ncomments\:\ true/' *.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment