LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Tricky grep question (https://www.linuxquestions.org/questions/programming-9/tricky-grep-question-399544/)

amytys 01-04-2006 03:10 PM

Tricky grep question
 
I'm trying to return the lines from a file that contain a comma in any of the first 9 characters. Any other characters are fine, as long as there's a comma somewhere in the first 9 characters. This needs to run from a commandline. Any suggestions?

Berhanie 01-04-2006 04:16 PM

How about
Code:

grep "^.\{0,8\}," myfile


All times are GMT -5. The time now is 04:11 AM.