I have a below file, How to extract the row which is having 5.6 version number. I need to find the regex pattern
A KB 1024 MYsql root
B GB 1 ELK-6
C KB 1024 Mysql5.6
E KB 1024 ELK
F GB 1 Mysql5.6
Expected Out
C KB 1024 Mysql5.6
F GB 1 Mysql5.6
My Code in pandas
import re
infile = r'C:\user\Desktop\m.txt'
df_list = []
with open(infile) as f:
for line in f:
# remove whitespace at the start and the newline at the end
line = line.strip()
# split each column on whitespace
columns = re.split('\s+', line, maxsplit=4)
df_list.append(columns)
df = pd.DataFrame(df_list)
df[df[3].str.contains("5.6")]
I need to do with regex with Python not with Pandas dataframe. i didnt tag pandas