Last active
November 6, 2018 00:37
-
-
Save naganowl/335b1445be2367cdbb22b61403db1bfc to your computer and use it in GitHub Desktop.
Add text after first line of file
This file contains hidden or 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
# Inspired by Stack Overflow Question 19151954 | |
LINE_NO = `grep -n require $1 | tail -1 | cut -d: -f1` | |
sed ''"${LINE_NO}"' a \ | |
text_to_add | |
' $1 |
This file contains hidden or 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
# Stack Exchange Question #99350 | |
sed '1 a \ | |
stuff_to_add | |
' $FILE_NAME | tee $FILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment