Skip to content

Instantly share code, notes, and snippets.

@loochao
Created November 21, 2016 21:48
Show Gist options
  • Select an option

  • Save loochao/230bab67966466699c5c25192b6699e3 to your computer and use it in GitHub Desktop.

Select an option

Save loochao/230bab67966466699c5c25192b6699e3 to your computer and use it in GitHub Desktop.
Split big library index files (txt format) into smaller ones (10000 lines per file)
archive="../_lib.idx_achive/"
if [ ! -d $archive ]; then
mkdir $archive
fi
for i in `ls`; do
if [ $i != $0 -a ! -d $i ]; then
fullname=$i;
name=${i%.*};
if [ ! -d $name ]; then
mkdir $name;
fi
gsplit -l 10000 -d --additional-suffix=.txt $fullname $name/$name"_"
mv $fullname $archive
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment