2
我想遍历FILELIST扩展名的目录中的所有文件,我设法做到这一点。但后来我想阅读这些文件的内容,其中包含其他文件的路径和文件名。这些文件,我想移动到另一个位置。Linux shell:如何迭代多个文件列表并对文件中的每一行执行操作?
FileA.FILELIST
/somepath/File1.csv
/somepath/File2.csv
FileB.FILELIST
/somepath/File3.csv
/somepath/File4.csv
我有什么那么远,
#!/bin/bash
# Iterate all file lists
for fl in /path/Inbox/*.FILELIST
do
#Iterate the content of the current file list
while read line;
do
#Move it to the Archive directory...
done < $fl
done
在此先感谢!
只需用'mv“替换'#Move ...'行$ line”/ archive/dir' – anubhava