Skip to content

Instantly share code, notes, and snippets.

@naganowl
Last active November 6, 2018 00:37
Show Gist options
  • Save naganowl/335b1445be2367cdbb22b61403db1bfc to your computer and use it in GitHub Desktop.
Save naganowl/335b1445be2367cdbb22b61403db1bfc to your computer and use it in GitHub Desktop.
Add text after first line of file
# 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
# 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