Skip to content
Snippets Groups Projects
Commit 95390697 authored by ys554's avatar ys554
Browse files

changing directory name

parent 68225ba0
Branches
No related tags found
No related merge requests found
#!/bin/bash
#Yegeon Seo
#ARCHIVE="$PWD"
#Number of dir
dir=$(ls -d $ARCHIVE/*/ | wc -l)
#Number of prob
prob=$(ls -R -l $ARCHIVE/*/ | egrep -n "prob*" | wc -l )
#Printing output
echo -e "$dir\t$prob"
#!/bin/bash
#Yegeon Seo
#ARCHIVE=$PWD
#placeholders
largestThread=0
largestFile=""
#Loop through each folder
for folder in $ARCHIVE/*/; do
if [ -d $folder ]; then
cd $folder
#For each file in the folder, get the name of the file and the number of thread
for file in *; do
filename="${file%_*}"
numThread=$(find -name "$filename*"| wc -l)
#if the number of thread is greater than current largest thread, replace
if [ $numThread -gt $largestThread ]; then
largestThread=$numThread
largestFile=$filename
fi
done
cd ..
fi
done
#print the output
printf "$largestThread\t$largestFile\n"
#!/bin/bash
#Yegeon Seo
#ARCHIVE="$PWD"
#Exit if there is no argument
if [ $# == 0 ]; then
echo "No arguments!! Exiting the program/" ; exit
fi
#Format the date
date="$3/$2/$1"
#Search ARCHIVE using grep to get files
files=$(grep -rl $date $ARCHIVE)
#Print matching files
for file in $files; do
echo $(basename $file)
done
#!/bin/bash
#Yegeon Seo
#ARCHIVE=$PWD
#Read all the files starting with email regular expression and store it in a temp file
grep -oErh "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" $ARCHIVE/* >> tempfile
#extract hostname from the email
while read email; do
extension="${email##*@}"
echo $extension >> temp
done < tempfile
#Sort hostmames and remove duplicateds. Order by number in descending order.
sort --ignore-case temp | uniq -cdi | sort -nr -o temp
#Print hostnames and the number of messages sent using awk
awk '{print $2, $1}' temp
#remove temp files made
rm temp tempfile
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment