我有2个相同的.txt文件,其中命名中有1个零件相同,而其他部分则不同。我想根据以下条件打印文件
- 文件名1:
alert_human _*。txt
- 文件名称2:
alert_human_abc _*。txt
*
表示
我试图将这些文件名写入<<<<< Code> code> sublefiles.txt 通过使用我保存在不同的不同的shell脚本搜索文件,将人/temp
目录放在中目录(人/STG
)。
注意我仅保留alert_human _*。但是它将该文件写为
alert_human_abc _*。txt
。
因此,根据以下条件,我想打印文件名。
alert_human_abc _*。txt
- 如果存在此文件,则应仅打印此文件名。alert_human _*。txt
- 如果存在此文件,则应仅打印此文件名,该文件名不应将其打印为第一个提到的文件名。
我曾经像
echo 'alert_human_abc_*.txt > temp/availablefiles.txt
echo 'alert_human_*.txt > temp/availablefiles.txt
- file name 1 :
alert_human_*.txt
- file name 2 :
alert_human_abc_*.txt
*
denotes the timestamp
I am trying to write these filenames to availablefiles.txt
file which is placed in human/temp
directory by searching the files using a shell script that I have kept in different directory (human/stg
).
Note I have kept only alert_human_*.txt
in human/stg
directory. But it writes that file as alert_human_abc_*.txt
.
So based on below condition I want to print the filenames.
alert_human_abc_*.txt
- if this file is present, it should print only this filename.alert_human_*.txt
- if this file is present, it should print only this filename which should not print as 1st mentioned file name.
I have used like
echo 'alert_human_abc_*.txt > temp/availablefiles.txt
echo 'alert_human_*.txt > temp/availablefiles.txt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题不太清楚,但这里是。
alert_human_abc _*。txt
,则将匹配模式写入文件。alert_human _*。txt
是编写的。如果您想要与输出文件中每个模式匹配的文件列表,请这样修改:
find
的结果。Your question is not super clear, but here goes.
alert_human_abc_*.txt
, that matching pattern is written to the file.alert_human_*.txt
is written.If you wanted the list of files that match each pattern in your output file, modify like this:
find
using that pattern to the output file.