Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 5494  / 2 Years ago, fri, october 21, 2022, 7:43:53

I have a set of data files (*.all) located in different folders



Documents/rawdata/Geob1005/1.all, 2.all, 3.all,...,n.all
Documents/rawdata/Geob1006/A.all, B.all, C.all,...,Z.all and so on...


I have created a file called datalist.mb-1 in each directory which lists all the *.all files located in the same directory using:



/bin/ls -1 *.all | awk '{print $1" 58"}' >datalist.mb-1


so I get this:



Documents/rawdata/Geob1005/datalist.mb-1
Documents/rawdata/Geob1006/datalist.mb-1
and so on...


Now I need to create a "master" datalist in Documents/rawdata/ that points out to all the other datalists inside the directories of rawdata/



I need the outcome of the "master" datalist to look like this:



Geob1005/datalist.mb-1  -­1 
Geob1006/datalist.mb-1 -1


Any idea of how to do this task?



Thanks in advance.


More From » files

 Answers
5

I finally managed to do it using Locate, actually I didn't need the full path but using awk was enough to just show just the path from the "geo" subdirectory.



This is how I did it:



locate ~/Documents/rawdata/*/datalist.mb-1 | awk 'BEGIN {FS="/"} {print $4 "/" $5 " -1"}' > master.txt


[#30026] Friday, October 21, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
ingssex questions
;