Calling gawk from python

Posted by chavanak on Stack Overflow See other posts from Stack Overflow or by chavanak
Published on 2010-03-21T00:44:29Z Indexed on 2010/03/21 0:51 UTC
Read the original article Hit count: 567

Filed under:
|

Hi,

I am trying to call gawk from python in this manner.

import os
import string
import codecs

ligand_file=open( "2WTKA_ab.txt", "r" ) #Open the receptor.txt file
ligand_lines=ligand_file.readlines() # Read all the lines into the array
ligand_lines=map( string.strip, ligand_lines ) 
ligand_file.close()

for i in ligand_lines:
    os.system ( " gawk %s %s"%( "'{if ($2==""i"") print $0}'", 'unique_count_a_from_ac.txt' ) )

My problem is that "i" is not being replaced by the value it represent. The value "i" represents is an integer and not a string. Can anyone help me out? Cheers, Chavanak

© Stack Overflow or respective owner

Related posts about python

Related posts about gawk