Extracting selected text from .txt file

ROOT Version: 5.34
Platform: Not Provided
Compiler: GCC

I want to do something like this. We have a file TEST.txt file which looks like -

This is line 1
This 2
Line 3 is here
4th line
5 line is here we have
I want to copy this number 2235001453 from this line.
I want to skip this line.
Skip this too.
Copy Me
Hello and bye
This is EOF.

Now I want to create a file after reading the above file. Output.txt containing -

Copy Me

Please suggest how to do.

I would loop over the file reading each line in a std::string or a TString and use the tools these two classes provide to parse and select the information you need.

Thank you. But I am not familiar with strings. Could you please write a small macro.

hish.C (363 Bytes)
hish.txt (198 Bytes)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.