I have a text that looks like the following.
<DIV>SOFTWARE V1.0.1.0.RDZCUAJ DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.2.0.VWZMXQE DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.3.0.GSVZQKE DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.4.0.UIUVAZD DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.5.0.ELBXBGB DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
I need to remove the 8 characters in front of DOWNLOAD</DIV>
, it eventually looked like this.
<DIV>SOFTWARE V1.0.1.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.2.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.3.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.4.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.5.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
Is it possible to do this with the sed or awk command?
Any help is appreciated in advance!
A very simple approach is the following:
$ sed 's,.........DOWNLOAD</DIV>, DOWNLOAD</DIV>,g' input.txt
<DIV>SOFTWARE V1.0.1.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.2.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.3.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.4.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
<DIV>SOFTWARE V1.0.5.0 DOWNLOAD</DIV>
<DIV>...</DIV>
<DIV>...</DIV>
That replaces 9 characters in front of DOWNLOAD</DIV>
and replaces it with DOWNLOAD</DIV>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments