Skip to content

Instantly share code, notes, and snippets.

@chuckwagoncomputing
Created August 10, 2013 16:53
Show Gist options
  • Save chuckwagoncomputing/6201154 to your computer and use it in GitHub Desktop.
Save chuckwagoncomputing/6201154 to your computer and use it in GitHub Desktop.
Text insertion in functions
#!/bin/bash
LINE=$((`grep -n "$2()" $1 | head -c 1`+1))
./insert.sh $1 $LINE "$3"
exit
#!/bin/bash
POS=$2
LENGTH=`cat $1 | wc -l`
echo -e "`cat $1 | head -n $2`\n$3\n`cat $1 | tail -n $((LENGTH-POS))`" > $1
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment