python - Using sed in a Jython script to replace a whole line with a variable in a text file -
in jython script trying replace entire line of text file (the 2nd line in case) directory address contains variable (var).
obsids=str(obsids[i]) print type(obsids) os.system('sed -i "2 s:.*:/usr/data/$obsids/:" /usr/software/file.txt') where obsids unicode of whole number, string (usually 1342204440).
please can show me error in script.
thanks.
we got in comments:
obsids=str(obsids[i]) print type(obsids) os.environ['obsids']=obsids # makes python variable behave inside unix os.system('sed -i "2 s:.*:/usr/data/$obsids/:" /usr/software/file.txt')
Comments
Post a Comment