Created
April 23, 2009 18:02
-
-
Save niko/100645 to your computer and use it in GitHub Desktop.
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
function greparate() { | |
PATTERN=$1; | |
FILENAME=$2; | |
FILENAME_WITH=`echo $FILENAME | sed "s/\.\([^\.]*\)$/.with_$PATTERN.\1/"`; | |
FILENAME_WITHOUT=`echo $FILENAME | sed "s/\.\([^\.]*\)$/.without_$PATTERN.\1/"`; | |
echo "Seprating the content of $FILENAME by $PATTERN into $FILENAME_WITH and $FILENAME_WITHOUT" | |
grep $PATTERN $FILENAME > $FILENAME_WITH; | |
grep -v $PATTERN $FILENAME > $FILENAME_WITHOUT; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment