私は、特定の番号に基づいて一つのファイルに特定のファイル(XXXXXXX_Abstract_TOC.txt
、XXXXXXX_Chapter1.txt
、XXXXXXX_Chapter2.txt
、XXXXXXX_Chapter3.txt
、XXXXXXX_Chapter4.txt
、XXXXXXX_Conclusion.txt
)をマージしたいと考えていますテキストファイル(/util_files/list_NRPs.txt)から来てください。のUnix/bashの/シェル:リストからファイルを検索し、一つのファイルにマージする方法
注:Xは[0-9]
桁
次のようにlist_NRPs.txtは含まれています
は0030001
0030002
0030004
...
/All_Filesフォルダで、私はファイルを持って次のように
0030001_Abstract_TOC.txt
0030001_Chapter1.txt
0030001_Chapter2.txt
0030001_Chapter3.txt
0030001_Chapter4.txt
0030001_Conclusion.txt
0030002_Abstract_TOC.txt
0030002_Chapter1.txt
0030002_Chapter2.txt
0030002_Chapter3.txt
0030002_Chapter4.txt
0030002_Conclusion.txt
0030004_Abstract_TOC.txt
0030004_Chapter1.txt
0030004_Chapter2.txt
0030004_Chapter3.txt
0030004_Chapter4.txt
0030004_Conclusion.txt
...
各XXXXXXXからlist_NRPs.txtXXXXXXX_Abstract_TOC.txt
、XXXXXXX_Chapter1.txt
、XXXXXXX_Chapter2.txt
、XXXXXXX_Chapter3.txt
、XXXXXXX_Chapter4.txt
、XXXXXXX_Conclusion.txt
をXXXXXXX_All.txt
にマージします。
/All_Filesフォルダ内の最後のプロセスは次のようになります。
0030001_Abstract_TOC.txt
0030001_Chapter1.txt
0030001_Chapter2.txt
0030001_Chapter3.txt
0030001_Chapter4.txt
0030001_Conclusion.txt
0030001_All.txt
0030002_Abstract_TOC.txt
0030002_Chapter1.txt
0030002_Chapter2.txt
0030002_Chapter3.txt
0030002_Chapter4.txt
0030002_Conclusion.txt
0030002_All.txt
0030004_Abstract_TOC.txt
0030004_Chapter1.txt
0030004_Chapter2.txt
0030004_Chapter3.txt
0030004_Chapter4.txt
0030004_Conclusion.txt
0030004_All.txt
...
私はcat ../util_files/list_NRPs.txt | xargs
で始めたいと思いますが、私は続行するのか分かりません。
どうすればいいですか?
悪いアイデアストア 'ALL'一緒に同じディレクトリに' parts'(章、TOC)で。その後の実行では、Allをリストから除外し、グロビング(ワイルドカード)を複雑にする必要があります。 – jm666
注目、@ jm666に感謝 –