Hi,
I have to search for first occurenceof string str1 in a file(>5GB).
Now, after I have that , I have to search backwards from that offset till I get another string str2. I should also be able to get the
new string str2's offset.
Similarly, I look for last occurence of str1 and then have to search forward from there for str2 and get its offset .
First occurence :--
grep str1 file | head -1
Last occurence :--
grep str1 file | tail -1
But, I dont know how to do relative search in backward & forward directions, so that I have their offsets ..??
Please help...
finder