I need to extract values inside first parenthesis from a txt.gz
file while reading it using pandas read_csv
method.
The records inside txt.gz
looks like below one
2022-02-20 00:00:10.061 INFO [140191547254528] - ocm_input [14] sending Requestcom.com.sdcm.RequestScore("6016293021","JKT","ID","AP","SUB","ID","AP","FOIGTW",1,"","EWF","ID","national",11163.568125276915,.5,.24,0,0,0,"JKT","SUB","","","OISS INDONESIA","N",0,1,"FOCIDIGTW","","","jms:WebSphere_MQ-default-sender")..............context(1,"main",true)
I'm looking for something like this example but for txt.gz
file. In this example the values are being extracted from a string using StringIO
but I need to do that from a .gz
file. Also looking for best possible way if any.
What I'm looking for is to get the below values in pandas dataframe.
("6016293021","JKT","ID","AP","SUB","ID","AP","FOIGTW",1,"","EWF","ID","national",11163.568125276915,.5,.24,0,0,0,"JKT","SUB","","","OISS INDONESIA","N",0,1,"FOCIDIGTW","","","jms:WebSphere_MQ-default-sender")
What I'm looking for :
pd.read_csv(gzfilepath, compression='gzip',header=None, sep='\s*\(', quotechar='"', names=column_names,nrows=1000)
But I'm unable to read it that way. All I want is to extract values inside parenthesis while reading the .gz
file