How can I format my grep output to show line numbers at the end of the line, and also the hit count?

后端 未结 8 420
忘掉有多难
忘掉有多难 2021-01-29 17:46

I\'m using grep to match string in a file. Here is an example file:

example one,
example two null,
example three,
example four null,

grep

相关标签:
8条回答
  • 2021-01-29 18:06

    Use -n or --line-number.

    Check out man grep for lots more options.

    0 讨论(0)
  • 2021-01-29 18:07

    Refer this link for linux command linux http://linuxcommand.org/man_pages/grep1.html

    for displaying line no ,line of code and file use this command in your terminal or cmd, GitBash(Powered by terminal)

    grep -irn "YourStringToBeSearch"
    
    0 讨论(0)
提交回复
热议问题