Basic Linux Command Exercise [on hold]
I was given the following worksheet by a friend to help me better understand basic Linux shell commands. I'm a bit lost on the command chain. If someone could answer the question, and provide a brief explanation, I'd really appreciate it.
Thank you. Looking forward to learning more from this site.
The data in webstats.log has the following format:
• Each line in the log file is equal to one visit
• The oldest visit
is the first line
• The newest visit is the last line
• The log is a
tab-delimited file with 6 columns of data. It will be necessary to
extract data from a specific column and break it down further.
• The
columns in the log file are in the order below, and contain the
following data:
IP address of the visitor.
Username of the visitor
Date and time the user visited.
The HTTP GET or POST request for a resource
URL requested by the visitor.
Information about the browser used and browser's version number used by the visitor such as Firefox or Internet Explorer (MSIE)
For example, the first line of webstats.sh has the following columns
of data:
192.168.28.168
user143
[08/May/2010:09:52:52]
"GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
HTTP/1.1"
"http://www.example.com/index.html"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
Step 1. Get the first (oldest) visit and last (newest) visit in
webstats.log. Do not display the time of day, just the date. An
example date format would be 01/Jan/2017. HINT: Before modifying
webstats.sh, you can save time by first experimenting on the command
line with the command chain of pipe operations
Step 1a – oldest date Let's think about what you need to do to get the
oldest date
The first line of webstats.log is the oldest line, so
you need to extract that line. What command will do that?
The date is found in the third column, so you need to extract that column. What command will do that? You will pipe STDOUT from the
command #1 as STDIN for command #2.
The date looks like [08/May/2010:09:52:52] but you only want 08/May/2010. First, you need to remove the brackets and the time of
day? What command will remove the brackets? Search the Internet for
how to remove characters (like bracket) from a line of text.
Next, you need to remove the time of day. HINT: Think about the string as a number of columns separated by a delimiter character. Look
at the string. What character can be used as the delimiter?
Now determine how many columns exist using that delimiter character. What column do you want to extract? What command can
extract the desired column using that delimiter character?
What is the command chain you will run to get the first visit?
text-processing
New contributor
put on hold as too broad by Michael Homer, Sergiy Kolodyazhnyy, terdon♦ 2 hours ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I was given the following worksheet by a friend to help me better understand basic Linux shell commands. I'm a bit lost on the command chain. If someone could answer the question, and provide a brief explanation, I'd really appreciate it.
Thank you. Looking forward to learning more from this site.
The data in webstats.log has the following format:
• Each line in the log file is equal to one visit
• The oldest visit
is the first line
• The newest visit is the last line
• The log is a
tab-delimited file with 6 columns of data. It will be necessary to
extract data from a specific column and break it down further.
• The
columns in the log file are in the order below, and contain the
following data:
IP address of the visitor.
Username of the visitor
Date and time the user visited.
The HTTP GET or POST request for a resource
URL requested by the visitor.
Information about the browser used and browser's version number used by the visitor such as Firefox or Internet Explorer (MSIE)
For example, the first line of webstats.sh has the following columns
of data:
192.168.28.168
user143
[08/May/2010:09:52:52]
"GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
HTTP/1.1"
"http://www.example.com/index.html"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
Step 1. Get the first (oldest) visit and last (newest) visit in
webstats.log. Do not display the time of day, just the date. An
example date format would be 01/Jan/2017. HINT: Before modifying
webstats.sh, you can save time by first experimenting on the command
line with the command chain of pipe operations
Step 1a – oldest date Let's think about what you need to do to get the
oldest date
The first line of webstats.log is the oldest line, so
you need to extract that line. What command will do that?
The date is found in the third column, so you need to extract that column. What command will do that? You will pipe STDOUT from the
command #1 as STDIN for command #2.
The date looks like [08/May/2010:09:52:52] but you only want 08/May/2010. First, you need to remove the brackets and the time of
day? What command will remove the brackets? Search the Internet for
how to remove characters (like bracket) from a line of text.
Next, you need to remove the time of day. HINT: Think about the string as a number of columns separated by a delimiter character. Look
at the string. What character can be used as the delimiter?
Now determine how many columns exist using that delimiter character. What column do you want to extract? What command can
extract the desired column using that delimiter character?
What is the command chain you will run to get the first visit?
text-processing
New contributor
put on hold as too broad by Michael Homer, Sergiy Kolodyazhnyy, terdon♦ 2 hours ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commandscut
,awk
,tail
,head
,date
,sed
,tr
.
– terdon♦
2 hours ago
add a comment |
I was given the following worksheet by a friend to help me better understand basic Linux shell commands. I'm a bit lost on the command chain. If someone could answer the question, and provide a brief explanation, I'd really appreciate it.
Thank you. Looking forward to learning more from this site.
The data in webstats.log has the following format:
• Each line in the log file is equal to one visit
• The oldest visit
is the first line
• The newest visit is the last line
• The log is a
tab-delimited file with 6 columns of data. It will be necessary to
extract data from a specific column and break it down further.
• The
columns in the log file are in the order below, and contain the
following data:
IP address of the visitor.
Username of the visitor
Date and time the user visited.
The HTTP GET or POST request for a resource
URL requested by the visitor.
Information about the browser used and browser's version number used by the visitor such as Firefox or Internet Explorer (MSIE)
For example, the first line of webstats.sh has the following columns
of data:
192.168.28.168
user143
[08/May/2010:09:52:52]
"GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
HTTP/1.1"
"http://www.example.com/index.html"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
Step 1. Get the first (oldest) visit and last (newest) visit in
webstats.log. Do not display the time of day, just the date. An
example date format would be 01/Jan/2017. HINT: Before modifying
webstats.sh, you can save time by first experimenting on the command
line with the command chain of pipe operations
Step 1a – oldest date Let's think about what you need to do to get the
oldest date
The first line of webstats.log is the oldest line, so
you need to extract that line. What command will do that?
The date is found in the third column, so you need to extract that column. What command will do that? You will pipe STDOUT from the
command #1 as STDIN for command #2.
The date looks like [08/May/2010:09:52:52] but you only want 08/May/2010. First, you need to remove the brackets and the time of
day? What command will remove the brackets? Search the Internet for
how to remove characters (like bracket) from a line of text.
Next, you need to remove the time of day. HINT: Think about the string as a number of columns separated by a delimiter character. Look
at the string. What character can be used as the delimiter?
Now determine how many columns exist using that delimiter character. What column do you want to extract? What command can
extract the desired column using that delimiter character?
What is the command chain you will run to get the first visit?
text-processing
New contributor
I was given the following worksheet by a friend to help me better understand basic Linux shell commands. I'm a bit lost on the command chain. If someone could answer the question, and provide a brief explanation, I'd really appreciate it.
Thank you. Looking forward to learning more from this site.
The data in webstats.log has the following format:
• Each line in the log file is equal to one visit
• The oldest visit
is the first line
• The newest visit is the last line
• The log is a
tab-delimited file with 6 columns of data. It will be necessary to
extract data from a specific column and break it down further.
• The
columns in the log file are in the order below, and contain the
following data:
IP address of the visitor.
Username of the visitor
Date and time the user visited.
The HTTP GET or POST request for a resource
URL requested by the visitor.
Information about the browser used and browser's version number used by the visitor such as Firefox or Internet Explorer (MSIE)
For example, the first line of webstats.sh has the following columns
of data:
192.168.28.168
user143
[08/May/2010:09:52:52]
"GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
HTTP/1.1"
"http://www.example.com/index.html"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.0"
Step 1. Get the first (oldest) visit and last (newest) visit in
webstats.log. Do not display the time of day, just the date. An
example date format would be 01/Jan/2017. HINT: Before modifying
webstats.sh, you can save time by first experimenting on the command
line with the command chain of pipe operations
Step 1a – oldest date Let's think about what you need to do to get the
oldest date
The first line of webstats.log is the oldest line, so
you need to extract that line. What command will do that?
The date is found in the third column, so you need to extract that column. What command will do that? You will pipe STDOUT from the
command #1 as STDIN for command #2.
The date looks like [08/May/2010:09:52:52] but you only want 08/May/2010. First, you need to remove the brackets and the time of
day? What command will remove the brackets? Search the Internet for
how to remove characters (like bracket) from a line of text.
Next, you need to remove the time of day. HINT: Think about the string as a number of columns separated by a delimiter character. Look
at the string. What character can be used as the delimiter?
Now determine how many columns exist using that delimiter character. What column do you want to extract? What command can
extract the desired column using that delimiter character?
What is the command chain you will run to get the first visit?
text-processing
text-processing
New contributor
New contributor
edited 2 hours ago
terdon♦
131k32257436
131k32257436
New contributor
asked 2 hours ago
cjquestioncjquestion
1
1
New contributor
New contributor
put on hold as too broad by Michael Homer, Sergiy Kolodyazhnyy, terdon♦ 2 hours ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as too broad by Michael Homer, Sergiy Kolodyazhnyy, terdon♦ 2 hours ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commandscut
,awk
,tail
,head
,date
,sed
,tr
.
– terdon♦
2 hours ago
add a comment |
3
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commandscut
,awk
,tail
,head
,date
,sed
,tr
.
– terdon♦
2 hours ago
3
3
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commands
cut
, awk
, tail
, head
, date
, sed
, tr
.– terdon♦
2 hours ago
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commands
cut
, awk
, tail
, head
, date
, sed
, tr
.– terdon♦
2 hours ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
3
I'm sorry, but we won't just do your homework for you. Try something, and then come back and ask about specific parts that are giving you trouble. Hint: look up the commands
cut
,awk
,tail
,head
,date
,sed
,tr
.– terdon♦
2 hours ago