I have a file called alldatalist.txt
that contains:
../19970327/datalist.txt
../19970328/datalist.txt
../19970329/datalist.txt
../19970330/datalist.txt
../19970331/datalist.txt
../19970401/datalist.txt
../19970402/datalist.txt
../19970403/datalist.txt
../19970404/datalist.txt
../19970405/datalist.txt
Each file (or row in alldatalist.txt
) has its own content (for instance the first file/row):
$ cat ../19970327/datalist.txt
19970327_0100.xyz
19970327_0200.xyz
19970327_0300.xyz
19970327_0400.xyz
19970327_0500.xyz
I've been scratching my head trying to print the latter with the "outer" path from the alldatalist.txt
file, so to get this:
../19970327/19970327_0100.xyz
../19970327/19970327_0200.xyz
../19970327/19970327_0300.xyz
../19970327/19970327_0400.xyz
../19970327/19970327_0500.xyz
cat alldatalist.txt | xargs cat
produces the content of each file (or row in alldatalist.txt
) without the desired path, so I may include the paste
+ cut
(or basename
) tools to add each path using a for loop, but it seems that it may be an overcomplex solution. I was wondering if you can suggest me a trick to add that path in a cleaner and/or simpler way.
Any support is appreciated.