Skip to content

Instantly share code, notes, and snippets.

@malloc47 malloc47/mixin.sh
Created Apr 7, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.