using python on the command line with 'here-documents' and pipes

calmar calmar at calmar.ws
Sun Nov 14 12:12:42 EST 2004


Hi all,

I would like to use python for a replacement for some binutils. I would
like to be able to pipe things into python. Actually I would not like
writing a 'script' to handle the input, but write the python commands
right onto the command line.

It would be possible to use here-documents (for having the correct
identation during e.g while loops) for writing python code on
the fly, but then how and where to get the pipe output:

echo -e 'line1\nline2' | python <<EOF  ....

Does not really work...

Would anybody have an idea how to use python like e.g. awk etc. As a
tool within, where I can handle the stdin data, and write the code right
there (e.g. with here documents)?


thanks a lot
calmar

-- 
  calmar
          (o_  It rocks: LINUX + Command-Line-Interface
          //\
          V_/_                     http://www.calmar.ws



More information about the Python-list mailing list