Combine exported tar.gz performance measurement files from U2000


After exported measurement from U2K we’ve little bit problem, if you have several host, the files will be separated with the host. You can combine the files manually (extract files and open it one by one and copy paste), this method exactly not effective. The alternative you can use Excel External Tools like RDBmerge or another tools. But now we wanna create simple tools with Bash Script

Bash Script actually need running on Unix Operating System, but if used windows, we can use bash on windows alternatively

input: Exported tar.gz files
output: combined csv file

exec bash
array=($(ls *.gz))
for i in ${array[@]}; 
do 
echo $i;
tar -xzvf $i 
done
k=0
b=0
array_csv=($(ls *.csv))
p=${#array_csv[@]}
for i in ${array_csv[@]}; 
do
if [ "$k" -eq "$b" ] 
then
echo $i; 
cat $i | sed -n -e '8,$p' > test$k.txt
else
cat $i | sed -n -e '9,$p' > test$k.txt
fi
let k=$k+1
done
rm *.csv

NOW=$(date +"+%Y-%m-%d_%H%M%S")
NOWT=$(date +"%T")

FILE=Query_$NOW.csv
echo $FILE
cat *.txt > $FILE
rm *.txt
ls -l
rm *.gz
ls -l

Sample step by step

Export from u2K

Exported Folder

Change your file directory on bash into exported files folder

copy paste your script

csv file is ready

actually you still can optimize this method

Advertisements