I learned how to extract just the file names and line numbers from grep output (excluding the matched content itself):

grep -Rn . --include \*.rb --include \*.erb -e 'pluralize' | cut -f1,2 -d:

Here, cut truncates the output of each grepped line after and including the second delimited colon, leaving just the file path and line number, which are fields (or, columns) 1 and 2.


<
Previous Post
Bookmarklet to move new-comment Jira controls higher
>
Next Post
Ruby script for batch audio conversion