0

ファイル内に 102 個のファイルの場所のリストがあります。リスト内の各ファイルの内容を 1 つのファイルにマージする必要があります。

ファイル リスト内では、各行が 1 つのファイル名で構成されます。

UNIX環境でそれを行う方法を見つけるのを手伝ってください。

4

2 に答える 2

2

これは機能します:

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
于 2013-07-19T08:00:30.510 に答える
0

多分で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
于 2013-07-19T08:04:25.850 に答える