Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Final-Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ys554
Final-Project
Commits
95390697
Commit
95390697
authored
6 years ago
by
ys554
Browse files
Options
Downloads
Patches
Plain Diff
changing directory name
parent
68225ba0
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
assn1/prob1
+13
-0
13 additions, 0 deletions
assn1/prob1
assn1/prob2
+35
-0
35 additions, 0 deletions
assn1/prob2
assn1/prob3
+25
-0
25 additions, 0 deletions
assn1/prob3
assn1/prob4
+27
-0
27 additions, 0 deletions
assn1/prob4
with
100 additions
and
0 deletions
assn1/prob1
0 → 100755
+
13
−
0
View file @
95390697
#!/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
"
This diff is collapsed.
Click to expand it.
assn1/prob2
0 → 100755
+
35
−
0
View file @
95390697
#!/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
"
This diff is collapsed.
Click to expand it.
assn1/prob3
0 → 100755
+
25
−
0
View file @
95390697
#!/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
This diff is collapsed.
Click to expand it.
assn1/prob4
0 → 100755
+
27
−
0
View file @
95390697
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment