Skip to content

Commit

Permalink
Added filter
Browse files Browse the repository at this point in the history
  • Loading branch information
tb0hdan committed Apr 5, 2020
1 parent 85bfbc7 commit 20639c8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion unpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ function unpack() {
find ./data -type f -iname "*.xz" -exec xz -d -k {} \;
}

function filter() {
local fname=$1
cat ${fname}|egrep -v '^[\.|-|%]' > ${fname}.1
mv ${fname}.1 ${fname}
}

function combine() {
olddir=$(pwd)
for datadir in $(find ./data -type d -mindepth 1); do
cd ${datadir}
big_fname=$(ls *.txt|sed 's/[0-9]//g'|head -n 1)
big_fname=$(ls *.txt|sed -E 's/[0-9]+\./\./g'|head -n 1)
for fname in $(ls *.txt|grep '[0-9]\.txt'); do
cat $fname >> $big_fname
rm $fname
done
filter $big_fname
cd ${olddir}
done
}
Expand Down

0 comments on commit 20639c8

Please sign in to comment.