-
Notifications
You must be signed in to change notification settings - Fork 0
/
create
37 lines (36 loc) · 1.09 KB
/
create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
echo "If you are not sure if your files are in the correct format:"
echo "use ./convert first!"
sleep 5
if [ "$1" != "" ]; then
echo "Processing: ${1}"
path="$( cd "$(dirname "$0")" ; pwd -P )"
echo " Changing working path to: ${path}/${1}"
cd "${path}/${1}"
echo " Combining the files"
cat * > combined.tmp
echo " Sorting the output"
tr -d "\r" < combined.tmp | sort -u > $D.lst
echo " Removing temporary file"
rm combined.tmp
cd ..
echo " SUCCESS"
else
echo "No argument given. Everything will be processed.."
for D in *; do
if [ -d "${D}" ]; then
echo "Processing: ${D}"
path="$( cd "$(dirname "$0")" ; pwd -P )"
echo " Changing working path to: ${path}/${D}"
cd "${path}/${D}"
echo " Combining the files"
cat * > combined.tmp
echo " Sorting the output"
tr -d "\r" < combined.tmp | sort -u > $D.lst
echo " Removing temporary file"
rm combined.tmp
cd ..
echo " SUCCESS"
fi
done
fi