ChatGTP is a dead horse for programming. I don't advise any normal person to do any serious things with it.
Doesn't see many things at once, you have to draw him exactly what you want, the possibility of it predicting what you want is small... Example.....
I tell him that I want to separate segments from the text file...
Segments are separated by a vertical line |
In file 1.txt :
text1 | text2 | text3| text4
I want to get in file 2.txt :
text1 | text2 | text4
From file 1.txt . . .
And tells me dead serious here is a python script for you:
# Function to process the text and extract the desired parts
def extract_text(input_file, output_file):
with open(input_file, 'r') as f:
input_text = f.read()
# Regular expression pattern to capture the desired text
pattern = r'(\b\w+_\w+\b)\s*\|\s*(\b\w+_\w+\b)\s*\|\s*\w+\s*\|\s*(\b\w+_\w+\b)\s*\|'
matches = re.findall(pattern, input_text)
# Create the new text format from the extracted matches
output_text = "\n".join([" | ".join(match) for match in matches])
# Write the new text to the output file
with open(output_file, 'w') as f:
f.write(output_text)
# Example usage
input_file = '1.txt'
output_file = '2.txt'
extract_text(input_file, output_file)
The script does nothing....I have a blank file.
Too much dulls and overcomplicate it...
The solution is in bash one line
He says you are right, sorry for the confusion….
p.s.
If someone thinks that this story has nothing to do with the topic - it does.
This is 1.txt file
https://raw.githubusercontent.com/HomelessPhD/BTC32/main/BTC32_solved_unsolved.txt
https://github.com/albertobsd/keyhunt