Skip to content

Instantly share code, notes, and snippets.

@HCLarsen
Last active February 18, 2025 00:22
Show Gist options
  • Save HCLarsen/912d86d311f280bb58513d2446f2a1d8 to your computer and use it in GitHub Desktop.
Save HCLarsen/912d86d311f280bb58513d2446f2a1d8 to your computer and use it in GitHub Desktop.
A simple grep tool written in Crystal to display use of a RegExp and use of Command Line.
abort "Need a regex pattern" unless ARGV.size > 0
regex = ARGV.shift
STDIN.each_line do |i|
puts i if i =~ %r(#{regex})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment