gpt4 book ai didi

linux - Korn shell 获取最新的文件匹配模式

转载 作者:太空宇宙 更新时间:2023-11-04 12:57:22 25 4
gpt4 key购买 nike

需要帮助为以下内容编写 korn shell 脚本。

必须在目录..../script 中编写脚本

在目录 ..../files 中有以下文件

Have 2 file patterns 
xxx892_1.txt
xxx367_8.txt
xxx356_9.txt
yyy736_9.txt
yyy635_7.txt

需要获取最新的文件(last created)匹配模式

xxx 和 yyy 即来自上面的 xxx356_9.txt、yyy635_7 并通过 ftp 传输它们。

请在这方面寻求帮助。谢谢。

最佳答案

如果最晚你指的是时间戳。你可以这样做

ls -t xxx* | head -1  #this will give you the latest modified file
ls -t yyy* | head -1

以上将为您提供可用于 FTP 的文件名。

关于linux - Korn shell 获取最新的文件匹配模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35371039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com