Created
February 7, 2019 07:48
-
-
Save yglodt/28de98354e1f2e45ede9bb5939ea0234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 54321_xxxxxx_yyyyy.pdf | |
# 54321_xxxxxx_yyyyy.pdf | |
# 54321_xxxxxx_yyyyy.pdf | |
# will become 54321.pdf | |
# 54322_xxxxxx_yyyyy.pdf | |
# 54322_xxxxxx_yyyyy.pdf | |
# will become 54322.pdf | |
cd /mnt/c/TEMP/pdfs | |
list=""; | |
for file in *pdf; do | |
if [ -f "$file" ]; then | |
#echo "$file" | |
num="${file:0:5}" | |
list="$list $num" | |
fi | |
done | |
#echo $list | |
uniques=$(echo $list | tr ' ' '\n' | sort -nu) | |
#echo $uniques | |
for uni in $uniques; do | |
echo "Creating $uni ..." | |
pdfunite $(echo "$uni"_*) "merged/$uni.pdf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment