<commit_before>---
# slug: name of the challenge (required)
# description: describe teh challenge (required)
# example: solution for the challenge (required)
# expected_output:
#   lines: lines returned from the command, as an array (required)
#   order: whether or not order matters (optional, default is false)
#   re_sub: regex substitution on the output lines (optional)
#   regex: lines are regular expressions (optional)
#   tests: tests to run after the command completes

########## START BEGINNER

  - slug: hello_world
    description: |
      Print "hello world".
      Hint: There are many ways to print text on
      the command line, one way is with the 'echo'
      command.

      Try it below and good luck!
    example: echo 'hello world'
    expected_output:
      lines:
        - 'hello world'
  - slug: current_working_directory
    description: |
      Print the current working directory.
    example: pwd
    expected_output:
      lines:
        - '/var/challenges/current_working_directory'
  - slug: list_files
    description: |
      List all of the files in the current
      directory, one file per line.
    example: ls
    expected_output:
      lines:
        - 'README'
  - slug: print_file_contents
    description: |
      There is a file named "access.log" in the
      current directory. Print the contents.
    example: cat access.log
    expected_output:
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:29:57 +0100] "GET /posts/2/display HTTP/1.0" 200 3240
        - 172.16.31.10 - - [09/Jan/2017:22:30:43 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 1116
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.58.3 - - [09/Jan/2017:22:38:03 +0100] "GET /bar/create HTTP/1.0" 200 1116
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 192.168.127.12 - - [09/Jan/2017:22:44:25 +0100] "POST /posts/1/display HTTP/1.0" 200 3471
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:52:31 +0100] "DELETE /posts/2/display HTTP/1.0" 404 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: last_lines
    disp_title: Last lines in a file.
    description: |
      Print the last 5 lines of "access.log".
    example: tail -n 5 access.log
    expected_output:
      lines:
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 192.168.127.12 - - [09/Jan/2017:22:44:25 +0100] "POST /posts/1/display HTTP/1.0" 200 3471
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:52:31 +0100] "DELETE /posts/2/display HTTP/1.0" 404 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: find_string_in_a_file
    description: |
      There is a file named "access.log" in the
      current working directory. Print all lines
      in this file that contains the string "GET".
    example: grep 'GET' access.log
    expected_output:
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:29:57 +0100] "GET /posts/2/display HTTP/1.0" 200 3240
        - 172.16.31.10 - - [09/Jan/2017:22:30:43 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 1116
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.58.3 - - [09/Jan/2017:22:38:03 +0100] "GET /bar/create HTTP/1.0" 200 1116
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: search_for_files_containing_string
    description: |
      Print all files, one per line that contain
      the string "500".
    example: grep -l 500 *
    expected_output:
      order: false
      lines:
        - README
        - access.log
        - access.log.1
  - slug: search_for_files_by_extension
    description: |
      Print the relative file paths, one path
      per line for all files that start with
      "access.log" in the current directory.

    example: find . -name 'access.log*'
    expected_output:
      order: false
      re_sub: ['^\./', '']
      lines:
        - 'access.log'
        - 'access.log.1'
        - 'access.log.2'
  - slug: search_for_string_in_files_recursive
    description: |
      Print all matching lines (without the filename
      or the file path) in all files under the current
      directory that start with "access.log" that
      contain the string "500".
    example: grep -h 500 **/access.log*
    expected_output:
      order: false
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.31.10 - - [09/Jan/2017:22:41:26 +0100] "GET /pages/create HTTP/1.0" 500 2477
  - slug: extract_ip_addresses
    description: |
      Extract all IP addreses from files that
      that start with "access.log" printing one
      IP address per line.
    example: grep -Po '^\d+\.\d+\.\d+\.\d+' **/access.log*
    expected_output:<commit_msg>extract_ip_addresses: Use grep -h to avoid introducing filename prefixes<commit_after>---
# slug: name of the challenge (required)
# description: describe teh challenge (required)
# example: solution for the challenge (required)
# expected_output:
#   lines: lines returned from the command, as an array (required)
#   order: whether or not order matters (optional, default is false)
#   re_sub: regex substitution on the output lines (optional)
#   regex: lines are regular expressions (optional)
#   tests: tests to run after the command completes

########## START BEGINNER

  - slug: hello_world
    description: |
      Print "hello world".
      Hint: There are many ways to print text on
      the command line, one way is with the 'echo'
      command.

      Try it below and good luck!
    example: echo 'hello world'
    expected_output:
      lines:
        - 'hello world'
  - slug: current_working_directory
    description: |
      Print the current working directory.
    example: pwd
    expected_output:
      lines:
        - '/var/challenges/current_working_directory'
  - slug: list_files
    description: |
      List all of the files in the current
      directory, one file per line.
    example: ls
    expected_output:
      lines:
        - 'README'
  - slug: print_file_contents
    description: |
      There is a file named "access.log" in the
      current directory. Print the contents.
    example: cat access.log
    expected_output:
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:29:57 +0100] "GET /posts/2/display HTTP/1.0" 200 3240
        - 172.16.31.10 - - [09/Jan/2017:22:30:43 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 1116
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.58.3 - - [09/Jan/2017:22:38:03 +0100] "GET /bar/create HTTP/1.0" 200 1116
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 192.168.127.12 - - [09/Jan/2017:22:44:25 +0100] "POST /posts/1/display HTTP/1.0" 200 3471
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:52:31 +0100] "DELETE /posts/2/display HTTP/1.0" 404 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: last_lines
    disp_title: Last lines in a file.
    description: |
      Print the last 5 lines of "access.log".
    example: tail -n 5 access.log
    expected_output:
      lines:
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 192.168.127.12 - - [09/Jan/2017:22:44:25 +0100] "POST /posts/1/display HTTP/1.0" 200 3471
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:52:31 +0100] "DELETE /posts/2/display HTTP/1.0" 404 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: find_string_in_a_file
    description: |
      There is a file named "access.log" in the
      current working directory. Print all lines
      in this file that contains the string "GET".
    example: grep 'GET' access.log
    expected_output:
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:29:57 +0100] "GET /posts/2/display HTTP/1.0" 200 3240
        - 7192.168.127.12 - - [09/Jan/2017:22:30:43 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 1116
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.58.3 - - [09/Jan/2017:22:38:03 +0100] "GET /bar/create HTTP/1.0" 200 1116
        - 172.16.58.3 - - [09/Jan/2017:22:42:18 +0100] "GET /posts/1/display HTTP/1.0" 200 2477
        - 251.111.109.143 - - [09/Jan/2017:22:49:02 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 2477
        - 172.16.31.10 - - [09/Jan/2017:22:57:11 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 200 3471
  - slug: search_for_files_containing_string
    description: |
      Print all files, one per line that contain
      the string "500".
    example: grep -l 500 *
    expected_output:
      order: false
      lines:
        - README
        - access.log
        - access.log.1
  - slug: search_for_files_by_extension
    description: |
      Print the relative file paths, one path
      per line for all files that start with
      "access.log" in the current directory.

    example: find . -name 'access.log*'
    expected_output:
      order: false
      re_sub: ['^\./', '']
      lines:
        - 'access.log'
        - 'access.log.1'
        - 'access.log.2'
  - slug: search_for_string_in_files_recursive
    description: |
      Print all matching lines (without the filename
      or the file path) in all files under the current
      directory that start with "access.log" that
      contain the string "500".
    example: grep -h 500 **/access.log*
    expected_output:
      order: false
      lines:
        - 172.16.31.10 - - [09/Jan/2017:22:34:33 +0100] "GET /pages/create HTTP/1.0" 500 3471
        - 192.168.3.11 - - [09/Jan/2017:22:35:30 +0100] "GET /posts/foo?appID=xxxx HTTP/1.0" 500 2477
        - 172.16.31.10 - - [09/Jan/2017:22:41:26 +0100] "GET /pages/create HTTP/1.0" 500 2477
  - slug: extract_ip_addresses
    description: |
      Extract all IP addreses from files that
      that start with "access.log" printing one
      IP address per line.
    example: grep -Pho '^\d+\.\d+\.\d+\.\d+' **/access.log*
    expected_output:
{'fraction_non_alphanumeric': 0.1415529084427441, 'fraction_numerical': 0.1598991392052865, 'mean_word_length': 2.3013777267508613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 52, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5167260', 'n_tokens_mistral': 5386, 'n_tokens_neox': 4124, 'n_words': 1095}