Created
April 7, 2012 01:35
-
-
Save malloc47/2324425 to your computer and use it in GitHub Desktop.
mixin script that works as a "preprocessor"
This file contains 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
#!/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