prepare_data script now accepts a filter argument to process only a
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Wed, 7 Dec 2016 15:07:17 +0000 (17:07 +0200)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Wed, 7 Dec 2016 15:07:17 +0000 (17:07 +0200)
subset of data matching that filter (with grep)

tools/prepare_data

index 76ced9f..c1bf5f8 100755 (executable)
@@ -3,6 +3,7 @@
 indir=datasrc
 descfile=$indir/datadesc
 outdir=data
+filter=$1
 
 process()
 {
@@ -33,10 +34,14 @@ copy()
        fi
 }
 
+if [ -z "$filter" ]; then
+       filter='.*'
+fi
+
 mkdir -p $outdir
 
 while read line; do
-    line=$(echo $line | sed 's/#.*$//')
+    line=$(echo $line | sed 's/#.*$//' | grep "$filter")
     if [ -n "$line" ]; then
         path=$(echo $line | awk -F : '{ print $1; }')
         fname=$(basename $path)