I've got this problem.
I need to extract some words from text file, which I find by specific pattern in that text. For example:
/this/is/path:
file1.txt,date-3
file2.txt,date-2
/this/is/path2:
file.txt,date-1
file2.txt,date-5
The pattern would be the /path:
and to choose only lines after that and before another /path:
. Because there might be the same names of files. And I need to find exact file.txt
and take those 3 things:
- file
- date
- number of launch
into 3 variables.
Example: I have text document in format:
/home/name/Documents: file.txt,12.5.2014-1 file2.txt,15.8.2014-2 /home/name/Music: file.txt,15.4.2014-2 f2ile3.txt,8.2.2015-5 file2.txt,7.6.2014-3 /home/name/Video: file.txt,date-5
and there is directory music and documents which have same files and I want to chose from music only, file.txt. But when it will look for file.txt it will also find one in directory Documents so I only want to choose ones between directory music and it will end in directory Video. And when it finds the file.txt it will save it like this: 1.variable=file.txt, 2.variable=15.4.2014,3.variable=2.
/this/is/path/file1.txt
, but what is that “date 3” bit?