Basic Linux Command Exercise [on hold]












-2















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:




  1. IP address of the visitor.


  2. Username of the visitor


  3. Date and time the user visited.


  4. The HTTP GET or POST request for a resource


  5. URL requested by the visitor.


  6. 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:




  1. 192.168.28.168


  2. user143


  3. [08/May/2010:09:52:52]


  4. "GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
    HTTP/1.1"


  5. "http://www.example.com/index.html"


  6. "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




  1. The first line of webstats.log is the oldest line, so
    you need to extract that line. What command will do that?


  2. 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.


  3. 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.


  4. 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?


  5. 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?











share|improve this question









New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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 commands cut, awk, tail, head, date, sed, tr.

    – terdon
    2 hours ago


















-2















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:




  1. IP address of the visitor.


  2. Username of the visitor


  3. Date and time the user visited.


  4. The HTTP GET or POST request for a resource


  5. URL requested by the visitor.


  6. 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:




  1. 192.168.28.168


  2. user143


  3. [08/May/2010:09:52:52]


  4. "GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
    HTTP/1.1"


  5. "http://www.example.com/index.html"


  6. "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




  1. The first line of webstats.log is the oldest line, so
    you need to extract that line. What command will do that?


  2. 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.


  3. 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.


  4. 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?


  5. 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?











share|improve this question









New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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 commands cut, awk, tail, head, date, sed, tr.

    – terdon
    2 hours ago
















-2












-2








-2








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:




  1. IP address of the visitor.


  2. Username of the visitor


  3. Date and time the user visited.


  4. The HTTP GET or POST request for a resource


  5. URL requested by the visitor.


  6. 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:




  1. 192.168.28.168


  2. user143


  3. [08/May/2010:09:52:52]


  4. "GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
    HTTP/1.1"


  5. "http://www.example.com/index.html"


  6. "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




  1. The first line of webstats.log is the oldest line, so
    you need to extract that line. What command will do that?


  2. 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.


  3. 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.


  4. 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?


  5. 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?











share|improve this question









New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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:




  1. IP address of the visitor.


  2. Username of the visitor


  3. Date and time the user visited.


  4. The HTTP GET or POST request for a resource


  5. URL requested by the visitor.


  6. 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:




  1. 192.168.28.168


  2. user143


  3. [08/May/2010:09:52:52]


  4. "GET /NoAuth/js/scriptaculous/scriptaculous.js?load=effects,controls
    HTTP/1.1"


  5. "http://www.example.com/index.html"


  6. "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




  1. The first line of webstats.log is the oldest line, so
    you need to extract that line. What command will do that?


  2. 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.


  3. 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.


  4. 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?


  5. 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






share|improve this question









New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









terdon

131k32257436




131k32257436






New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









cjquestioncjquestion

1




1




New contributor




cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






cjquestion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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 commands cut, awk, tail, head, date, sed, tr.

    – terdon
    2 hours ago
















  • 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










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












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Loup dans la culture

How to solve the problem of ntp “Unable to contact time server” from KDE?

Connection limited (no internet access)