https://secure.csse.uwa.edu.au/run/help4407?p=np&rss=y
help4407 - Assignment 2, Q2help4407 - Assignment 2, Q2help4407http://blogs.law.harvard.edu/tech/rssThe University of Western AustraliaThu, 25 Jun 2020 11:53:02 +0800Thu, 25 Jun 2020 11:53:02 +0800Re: assignment 2 q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=235
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=235Thu, 21 May 2020 07:52:15 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
Hi Jordan,
It's always preferred to have a more general script, one that can process different inputs (without
having to change the script itself - which is actually much easier with a scripting approach, than a
compiled approach). So, yes, use of a command-line argument is preferred.
But it's simple to support both by checking if an argument was provided:
{{{
if [ $# == "0" ]
then
inputfile="default-input-file"
else
inputfile="$1"
fi
}}}
Re: assignment 2 q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=232
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=232Wed, 20 May 2020 15:33:38 +0800"Jordan Makins" <21317635@student.uwa.edu.au>Hi Chris,
Do you have a preference on whether our shellscript takes the text file url as an argument
when run from the command line or would you prefer its url pasted in and downloaded within
the script?
For the purpose as if you were to use the shellscript in the future for an updated version
of the text file.
Thanks,
Jordan
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=188
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=188Fri, 15 May 2020 18:04:10 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
All months just 3 characters long. Thanks.
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=187
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=187Fri, 15 May 2020 17:54:02 +0800"Mingbo Zhang" <22795074@student.uwa.edu.au>I mean like if we get data from April. the month format in logfile would be Apr or April?
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=185
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=185Fri, 15 May 2020 17:19:24 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
Sorry, I don't understand the question.
The first line in the same has (only) this date: 03/May/2020
What do you mean by short or full ??
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=184
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=184Fri, 15 May 2020 17:17:45 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
The logfile provided is a real one, and you can presume that any others will also be real.
No need to clean the data, as there (shouldn't) be any noisy data in it.
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=179
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=179Fri, 15 May 2020 17:04:01 +0800"Mingbo Zhang" <22795074@student.uwa.edu.au>One more question, the foramt of month in logfile is short one or full one? Thank
you!
Re: Assignment2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=177
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=177Fri, 15 May 2020 16:31:54 +0800"Mingbo Zhang" <22795074@student.uwa.edu.au>Hi Chris,
For task 2, do we need to do the data clean? Or we just need to write out the script
to draw the graph no matter whether the data is noisy. Thank you!
Re: Assignment 2 Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=169
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=169Fri, 15 May 2020 12:32:47 +0800"Thanh Tang" <22803018@student.uwa.edu.au>Thanks Christ.
Re: Assignment 2 Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=168
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=168Fri, 15 May 2020 03:55:45 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
I cannot tell what you mean by "I used a loop...", as there are many possible ways.
But my guess is that you have something like:
{{{
for i in `cat filename`
do
echo $i
done
}}}
This will not work as you probably hope, because placing a command in backquotes requests
that all of its output is appended onto one long line, with each of its original lines now
separated by spaces. Easily verified with a simple file of just 3 lines.
If this is what you're doing, change from that
"for i in ..."
loop to one using
""while read line ; do ...."
and the input lines will be preserved each time around the loop. Then *you* can break each
line into its fields.
Re: Assignment 2 Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=167
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=167Fri, 15 May 2020 02:25:41 +0800"Thanh Tang" <22803018@student.uwa.edu.au>When I used loop to print each line the file. It printed out
"10.4.0.14
...
...
[03/May/2020:03:09:27 +0800]
"GET
/run/help2200?p=np
HTTP/1.1"
200
42477"
It is not on the same line. Does this question require us to do some data cleaning
before draw charts?
Re: Assignment 2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=166
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=166Thu, 14 May 2020 15:48:13 +0800"Christopher McDonald" <chris.mcdonald@uwa.edu.au>
Yes, in the very same format as the sample (real) file provided.
Assignment 2, Q2
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=165
https://secure.csse.uwa.edu.au/run/help4407?p=np&a=165Thu, 14 May 2020 15:10:04 +0800"Mingbo Zhang" <22795074@student.uwa.edu.au>Hi Chris,
For the task2, the data is always from a text file, right? Thank you!