![]() |
![]() |
|
||||||||
![]() |
![]() |
![]() |
![]() |
||||||
![]() |
![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
![]() Administrator ![]() Group: Admin Posts: 118238 Joined: 3-June 05 From: Athens, Greece Member No.: 1 Zodiac Sign: ![]() Gender: ![]() ![]() |
"Hi I am trying to search my rails directory using grep. I am looking for a specific word and I want to grep to print out the file name and line number. Is there a grep flag that will do this for me? I have been trying to use a combination of -n and -l but these are either printing out the file names with no numbers or just dumping out a lot of text to the terminal which can't be easily read.
ex: CODE grep -ln "search" * Do I need to pipe it to a awk?" I think -l is too restrictive as it suppresses the output of -n. I would suggest -H, --with-filename Print the filename for each match. CODE grep -Hn "search" * If that gives too much output, try -o to only print the part that matches. CODE grep -nHo "search" * ![]() -------------------- |
|
![]() ![]() |
![]() ![]() ![]() |
Lo-Fi Version | Time is now: 1st July 2025 - 12:01 AM |
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More © 2005-2011. |