What operating system and shell are you using?
What tools do you want to use? (Does your forum user name mean you only want to use
perl?)
What have you tried? Please show us what you have tried (in CODE tags). If you had shown us what you have tried, some of the questions below would already have been answered.
You say that the 2nd and 3rd fields in your file are separated by a tab and a space, and that the 1st and 2nd fields are separated by a tab. But, there aren't any tabs in your file and (even if you had converted your tabs to spaces when you pasted your sample
TEXTFILE.TXT here, the 3rd field is not aligned as it would be if there had been a tab between fields???
How are the five strings found by your code? Are they operands passed to your script? Are they in another file? If so, what is the format of that file? Can any of the strings contain spaces? Can any of the strings contain any characters that are special in an extended regular expression, or do the strings just consist of alphanumeric characters?
You say that string1 and string2 and string4 and string5 should match field 2 in your file. Do they need to be in sequence within field 2 in the file (as they are in your example), or does each of those four strings just have to appear somewhere within field 2? Is string 3 also supposed to match (as it does in your example), or is your code just supposed to ignore string 3? Can the matches overlap, or does each of the four (or five) strings need to match unique substrings in field 2 (as they do in your example)?
Quote:
I need to search this sequence of strings from a file in such a way that the first two strings (string1 and string2) and last two strings (string4 and string5) should match with the strings in the SECOND column of a text file (consisting of three columns) after the comparison of the numbers from the respective column.
So, the script will perform searching for the strings which matches string1, string2, string4 and string5 from a big text file called TEXTFILE.TXT . Then, it'll return the string which has the biggest number (-ve number) in FIRST column and the string which has the biggest -ve number in the third column.
Does the above quote mean that you want the two matching fields that match all four strings and then from all of the fields matching that criteria choose the single matching field that also has the most negative value in field 1 and choose the single matching field that also has the most negative value in field 3?
Or, are you looking for the field matching string 1 and string 2 that has the most negative value in field 1 and for the field matching string 4 and string 5 that has the most negative value in field 3?
Are lines with non-negative values in fields 1 and/or 3 supposed to be ignored when matching the associated strings?