【发布时间】:2011-08-14 06:11:12
【问题描述】:
我需要搜索字符串 str1 出现在字符串 str2 之前的文件。两个字符串都在单独的行中。
例如, file1 看起来像:
abc
def
str1
ghi
str2
file2 看起来像:
abc
str2
def
ghi
str1
pqe
我的搜索应该返回 file1。
它应该是我可以在 unix 的命令行上运行的单行脚本。
提前致谢。
【问题讨论】:
标签: string unix search command-line awk