Pattern Search in Shell

Level 237 keystrokes

grep -r searches all .js files under ./src for TODO and prints each matching line with its file name.

Shell code

# -r searches ./src and all its subdirectories
# --include="*.js" limits it to .js files; without -n, matches print as file:line, no numbers
1grep -r "TODO" --include="*.js" ./src

Output

./src/app.js: // TODO: Add error handling
./src/utils.js: // TODO: Refactor this function
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • "× 4
  • -× 3
  • .× 2
  • *× 1
  • /× 1
  • =× 1

More Shell examples at level 2

← Shell typing practice