awk -F "[\t$]" '{if (substr($2, i, 1) > "\177"){}else{print $0}}' train.tsv >result.tsv
awk -F "[\t$]" '{if (substr($2, i, 1) > "\177"){}else{print $0}}' train.tsv >result.tsv
import re
lineList = []
matchPattern = re.compile(r'[\u4e00-\u9fa5]+')
file = open('E:\\Chrome_download\\math-formula-recognition-master\\train.tsv','r',encoding='UTF-8')
while 1:
line = file.readline()
if not line:
print("Read file End or Error")
break
elif matchPattern.search(line):
pass
else:
lineList.append(line)
file.close()
file = open(r'E:\\Chrome_download\\math-formula-recognition-master\\result.tsv', 'w',encoding='UTF-8')
for i in lineList:
file.write(i)
file.close()
|