-
Notifications
You must be signed in to change notification settings - Fork 1
/
RUN_format_3.sh
52 lines (41 loc) · 1.2 KB
/
RUN_format_3.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Copyright 2018 - 2024, MIT Lincoln Laboratory
# SPDX-License-Identifier: BSD-2-Clause
# RUN_format_3.sh
#
# $1 : Parent directory of .txt logs
# Parent directory of logs of OpenSky Impala shell in .txt format (see Step 2)
if [ -z "$1" ]; then
printf "Name of Parent directory of logs of OpenSky Impala shell in .txt format:"
IFS= read -r INDIR
else
INDIR=$1
fi
echo "input directory = $INDIR"
# Find directory names
# https://askubuntu.com/a/444554/244714
find "$(cd $INDIR ; pwd)" -mindepth 1 -maxdepth 1 -type d> output/3_dirArchiveDepth1.txt
find "$(cd $INDIR ; pwd)" -mindepth 2 -maxdepth 2 -type d> output/3_dirArchiveDepth2.txt
# Create counter
count=1
# Find files in each directory
while read d; do
find $d -name '*.txt' -print >> output/3_files.txt
#Advance counter
count=$(( $count + 1 ))
done < output/3_dirArchiveDepth2.txt
# Timer and Counter
SECONDS=0
count=1
# Serial
while read d; do
# Timer
SECONDS=0
# Call script to format from .txt to .csv
bash formatLogs_3.sh $d
# Record status to file and display to screen
echo $SECONDS >> output/3_seconds.txt
echo "i=$count, time=$SECONDS"
# Advance counter
count=$(( $count + 1 ))
done < output/3_files.txt