[IPython-User] 'awk' in ipython?

Thomas Kluyver takowl@gmail....
Sun Oct 14 04:50:12 CDT 2012


On 13 October 2012 13:32, Peng Cui <pengcui1989@gmail.com> wrote:
> a=['chr1','chr2','chr3']
> for eachitem in a:
> !awk '{print $1}' '/home/ckivip/Epigenetics/Data/H1hesc/Dnamethy.bed' >
> '/home/ckivip/Epigenetics/Data/H1hesc/Dnamethy/$$eachitem'

Both {foo} and $foo work for using variables from Python code, but you
will need to double them up where you want to pass {, } or $ to the
command. Try this:

!awk '{{print $$1}}'
'/home/ckivip/Epigenetics/Data/H1hesc/Dnamethy.bed' >
'/home/ckivip/Epigenetics/Data/H1hesc/Dnamethy/$eachitem

(The email splits it over three lines, but it should go all on one line)

Thomas


More information about the IPython-User mailing list