In a huge text file which I handle as a big string for efficiency reasons (I don't read the file line by line) I want to delete any character that is after -swf and before ||
I have a huge text which looks like this:
bla bla bla ||NULL||abc-swf||NULL||NULL
bla bla bla ||NULL||cdacda-swfend%23wrapclass||NULL||NULL
bla bla bla ||NULL||bgdbgdbgd-swf%28ML%29endBeliefnet.Web.UI.S||NULL||NULL
I want the final result to look like this:
bla bla bla ||NULL||abc-swf||NULL||NULL
bla bla bla ||NULL||cdacda-swf||NULL||NULL
bla bla bla ||NULL||bgdbgdbgd-swf||NULL||NULL
I can do this line by line using the partition function in python but it takes a lot of time since it requires to handle the file line by line and the file has more than 10M rows. Is there any way to do this by not examining the file line by line?