Created
June 13, 2012 16:07
-
-
Save matlinuxer2/2925005 to your computer and use it in GitHub Desktop.
embed python into shell script as a pipe function
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
#!/usr/bin/env bash | |
function pipe_in_python() { | |
python -c "$(cat <<EOPY | |
import sys | |
for line in sys.stdin: | |
print line.replace( 'asdf', 'ASDF' ), | |
EOPY | |
)" | |
} | |
echo "asdf.asdf.asdf.e" | pipe_in_python | cut -c5-15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment