Skip to content

Instantly share code, notes, and snippets.

View Jan-Zeiseweis's full-sized avatar

Jan Zeiseweis Jan-Zeiseweis

View GitHub Profile
@Jan-Zeiseweis
Jan-Zeiseweis / unzip_rm_zip_md5_sum_rm_dups.sh
Created September 14, 2015 17:17
Unzip all zip files in a directory and remove unzipped file if a file with the same md5checksum already unzipped
#!/bin/bash
declare -A arr
for zip_file in *.zip; do
unzip -q $zip_file && rm $zip_file
file=${zip_file%.zip}
read cksm _ < <(md5sum "$file")
if ((arr[$cksm]++)); then
echo "rm $file"
rm $file
fi
@Jan-Zeiseweis
Jan-Zeiseweis / split_and_gzip.sh
Last active September 14, 2015 17:15
split and gzip bash script
#!/bin/bash -e
# usage: bash ./split_and_gzip.sh file.txt
FILE=$1
LINES_PER_FILE=10000000 #10m
$(split -l $LINES_PER_FILE -d $FILE ${FILE}.)
FILES=${FILE}.*