Этот вопрос является продолжением предыдущего вопроса. . Мои требования к поиску приведены ниже
Несколько строк, которые необходимо найти, хранятся в файле values.txt (входной файл), который, например, содержит следующую информацию.
string1 1
string2 3
string3 5
- где первый столбец (строка1, строка2, строка3) указывает строки, которые необходимо найти, а второй столбец указывает количество вхождений для поиска.
- Далее поиск необходимо выполнять рекурсивно по файлам с определенным расширением (например, .out, .txt и т. д.).
- Результат поиска должен быть направлен в файл, где результаты поиска печатаются вместе с именами файлов и их путем.
Например, типичный вывод должен выглядеть так, как показано ниже (для рекурсивного поиска имен файлов с расширением .out).
<path_of_searched_file1/fileName1.out>
The full line containing the <first> instance of <string1>
The full line containing the <first> instance of <string2>
The full line containing the <second> instance of <string2>
The full line containing the <third> instance of <string2>
The full line containing the <first> instance of <string3>
The full line containing the <second> instance of <string3>
The full line containing the <third> instance of <string3>
The full line containing the <fourth> instance of <string3>
The full line containing the <fifth> instance of <string3>
<path_of_searched_file2/fileName2.out>
The full line containing the <first> instance of <string1>
The full line containing the <first> instance of <string2>
The full line containing the <second> instance of <string2>
The full line containing the <third> instance of <string2>
The full line containing the <first> instance of <string3>
The full line containing the <second> instance of <string3>
The full line containing the <third> instance of <string3>
The full line containing the <fourth> instance of <string3>
The full line containing the <fifth> instance of <string3>
and so on
Является ли использование awk лучшим способом решения этой проблемы поиска? Если это так, может ли кто-нибудь помочь мне изменить код awk, представленный в этом предыдущем вопрос, чтобы удовлетворить мои текущие требования к поиску.
value3
иvalue33
? - person Steve   schedule 03.06.2013