LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2006, 03:10 PM   #1
amytys
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Rep: Reputation: 0
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?
 
Old 01-04-2006, 04:16 PM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
How about
Code:
grep "^.\{0,8\}," myfile
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xorg tricky question festino114 Linux - General 4 06-29-2005 02:51 PM
Tricky installation question or1onas Linux - Newbie 3 04-28-2004 04:16 PM
a tricky question archlyric Linux - Newbie 3 02-27-2004 01:06 AM
Tricky Konqueror Question gbrad Linux - General 2 03-02-2003 05:32 PM
A Tricky question in Apache!! RKris Linux - Software 1 02-20-2003 08:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration