Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SpartanBotsAssignment3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
SpartanBotsAssignment3
Commits
86df5826
Commit
86df5826
authored
Sep 04, 2020
by
Samarth Joshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing q6 solution from Sailendra
parent
dde40bf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
q6/q6.sh
q6/q6.sh
+7
-0
No files found.
q6/q6.sh
View file @
86df5826
date
=
$(
sed
-E
-n
's/.*([0-9]{2})\/([0-9]{2})\/([0-9]{4})+.*/\3 \2 \1/;2p'
$1
)
meeting_start
=
$(
echo
$date
" "
$2
|
sed
's/:/ /g'
|
awk
'{ print mktime($0) }'
)
meeting_end
=
$(
echo
$date
" "
$3
|
sed
's/:/ /g'
|
awk
'{ print mktime($0) }'
)
#echo $meeting_start
#echo $meeting_end
sed
'1d'
$1
|
awk
"{ gsub(/:/,
\"
\"
,
\$
3); print
\$
1
\"
=
\"\$
2
\"
=
\"
; time=mktime(substr(
\$
3,7,4)
\"
\"
substr(
\$
3,4,2)
\"
\"
substr(
\$
3,1,2)
\"
\"
substr(
\$
3,13,8)); if(time<
$meeting_start
) { print
$meeting_start
\"\\
n
\"
} else if (time>
$meeting_end
) { print
$meeting_end
\"\\
n
\"
} else { print time
\"\\
n
\"
} }"
FS
=
"
\t
"
ORS
=
""
|
awk
" { if(
\$
2==
\"
Joined
\"
) { last_join[
\$
1]=
\$
3 } else { if(length(last_join)==0) { duration[
\$
1] =
\$
3-
$meeting_start
} else { duration[
\$
1] = duration[
\$
1] +
\$
3-last_join[
\$
1]; last_join[
\$
1]=
\"
open
\"
} } } END { for(joiner in last_join) { if(last_join[joiner]!=
\"
open
\"
) duration[joiner] = duration[joiner] +
$meeting_end
- last_join[joiner] } ;for (name in duration) { hours=int(duration[name]/3600);minutes=int((duration[name]/60)%60);seconds=int(duration[name]%60);if(hours<10) hours=
\"
0
\"
hours;if(minutes<10) minutes=
\"
0
\"
minutes;if(seconds<10) seconds=
\"
0
\"
seconds;print name
\"\\
t
\"
hours
\"
:
\"
minutes
\"
:
\"
seconds } }"
FS
=
"="
|
sort
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment