AWK - I need to write a one line shell command that will count all lines that

后端 未结 2 694
天涯浪人
天涯浪人 2021-01-27 10:54

I need to write this solution as an AWK command. I am stuck on the last question:


Write a one line shell command that will count all lines in a file called \"f

2条回答
  •  悲哀的现实
    2021-01-27 11:41

    I think the requirement is very clear

    Write a one line shell command that will count all lines in a file called "file.txt" that begin with a decimal number in parenthesis, containing a mix of both upper and lower case letters, and end with a period.

    1. begin with a decimal number in parenthesis
    2. containing a mix of both upper and lower case letters
    3. end with a period
    

    check all three conditions. Note that in 2. it doesn't say "only" so you can have extra class of characters but it should have at least one uppercase and one lowercase character.

    The example mixes concepts printing and counting, if part of the exercise it's very poorly worded or perhaps assumes that the counting will be done by wc by a piped output of a filtering script; regardless more attention should have been paid, especially for a student exercise.

    Please comment if anything not clear and I'll add more details...

提交回复
热议问题