Bash Scripting, looping through subdirectories to create 1 and 0 column of values
Hello, everybody, I have several subdirectories which contains several files with .SAC extension, for example
folder01 01.SAC 02.SAC 04.SAC Notice 03.SAC is missing. folder 02 02.SAC 03.SAC 04.SAC Notice 01.SAC is missing So, what I need is.. for every missing file display a 0, otherwise display 1 For example from folder01 I need a simple text file (lets say file01.dat)with a column with the following: 1 1 0 1 Similarly for folder02 I need (file02.dat) 0 1 1 1 And if possible merge all this, like: finalfile.dat 1 1 0 1 0 1 1 1 Is there a way to do this???? Thanks!! |
where in your script are you having problems ?
|
Honestly I haven't even tried, but no good ideas come to my mind
|
use the find command in a loop looking for 01.sac, 02.sac, 03.sac, ...
if the string that find returns is not zero length then echo '1'; else echo '0'. man find man test |
All times are GMT -5. The time now is 11:35 AM. |