ファイル内に 102 個のファイルの場所のリストがあります。リスト内の各ファイルの内容を 1 つのファイルにマージする必要があります。
ファイル リスト内では、各行が 1 つのファイル名で構成されます。
UNIX環境でそれを行う方法を見つけるのを手伝ってください。
これは機能します:
while read file
do
cat $file >> new_file
done < your_file_with_names
$ cat file1
aaa1
$ cat file2
aaa2
$ cat file3
aaa3
$ cat a
file1
file2
file3
$ while read file; do cat $file >> new_file; done < a
結果:
$ cat new_file
aaa1
aaa2
aaa3
多分でfor loop
:
LISTFILE="/path/to/file/with/list"
RESULTFILE="/path/to/result/file"
if test -f $RESULTFILE; then
rm $RESULTFILE;
fi
for f in `cat $LISTFILE`; do
cat $f >> $RESULTFILE;
done