Created
July 9, 2016 10:03
-
-
Save gonaumov/f5c54753c530cc21e7cef9e5500ed74c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# A little practice with sed from Georgi Naumov | |
stringToAppend="# we want to add this string\n" | |
filePath="apache2.conf" | |
# This will add bellow commend before the first occurence | |
# of LogFormat | |
# -r extended regular expression | |
# -i - in place | |
sed -ri '0,/(\bLogFormat\b)/s//'"$stringToAppend"'\1/' $filePath | |
printf "All done!\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment