Skip to content

Instantly share code, notes, and snippets.

@malloc47
Created April 7, 2012 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malloc47/2324425 to your computer and use it in GitHub Desktop.
Save malloc47/2324425 to your computer and use it in GitHub Desktop.
mixin script that works as a "preprocessor"
#!/bin/bash
num=$(grep -n \# $1 | awk -F: '{print $1}')
file=$(grep -n \# $1 | awk -F: '{print $2}' | awk '{print $2}')
if [ -n "$num" ] ; then
sed "${num}d" $1 > $2
sed -i "${num} a
" $2
sed -i "${num}r $file" $2
else
echo "Null"
cp $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment