File 1: sourcefile.txt
Hello, It's the beginning of the sentence.
it is the beginpoint of my career.
The end is always far.
We can start our beginpoint anytime we want.
The time we utilise to make our life good should be more.
This text doesn't mean anything.
I am writing this to include my three points:
beginpoint
time
end
File 2: strings.txt
beginpoint
end
time
Required output:
it is the beginpoint of my career
We can start our beginpoint anytime we want.
beginpoint
The end is always far.
end
The time we utilise to make our life good should be more.
time
I used
grep -w -F -f strings.txt sorcefile.txt > outputfile.txt
I got output:
it is the beginpoint of my career.
The end is always far.
We can start our beginpoint anytime we want.
The time we utilise to make our life good should be more.
beginpoint
time
end
So the lines are as needed but i want to group them by the search term order and not in the same order as the source file