'How to increase speed string processing in bash script?

I have string content as TXT file = 70 kb. I want to find and cut string with pattern.

Sample content.

"<div jsname="Rfh2Tc" class="SL4Sz" id="i3" role="alert"></div></div></div></div><div class="Qr7Oae" role="listitem"><div jsmodel="CP1oW" data-params="%.@.[1696921474,&quot;พื้นที่&quot;,null,2,[[TARGET_STRING,[[&quot;BKK"

I use this code in bash script.

DATA=`cat content.txt`
DATA=${DATA##*พื้นที่&quot}
DATA=${DATA%\,\[\[*}
echo $DATA

It's work. But! When it run, It very slow for 60++KB text file. and high CPU usage. How can I fix it, Please help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source