hi i want to find a string in file then retrieve the rest,this is an exemple of a line: taske :say_hellow do i want retrieve just "say_hellow" so how can i do please. thanks.
Should be able to do something like to separate the tasks:
u = open( "myfile" ) while line = u.gets if line.include?( "taske :" ) anArray = line.split(' ') puts anArray[1] if anArray.length > 0 end end
You could even combine the split function with the index function line,split(' ')[1] if you are sure where the target info will be.
Note: Don't be afraid to try different things. This solution is only one of many and others here could do a lot better. You could do better with a little practice and research.