grep command limitation

grep command limitation

Post by Barry Margoli » Tue, 21 Oct 1997 04:00:00





>Can any one give me an idea of how to work around the length
>limitation of
>grep ?.

I'll bet GNU grep doesn't have a limit on line length.

P.S. End a sentence either with a question mark or a period, not both.

--

GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.

 
 
 

1. How to make grep select both lines using only a single 'grep' command

: Hello,
:       We have an ASCII file called "ships" with lines in this format:

:       .....      3HO/3HA(PNTN) 4SD .....       [line 1]
:       .....      3HO/3HA 4SD .....             [line 2]
:       .                                        [line n]

:       The stuff in the parenthesis (the string "PNTN") can change.

:       Is there a single grep/egrep regular expression that can display
:       both lines?

:       I tried:

:       1. grep -i "3ho/3ha * 4s" ships,    showed line 2 only
:       2. grep -i "3ho/3ha* 4s" ships ,    showed line 2 only
:       3. grep -i "3ho/3ha *4s" ships ,    showed line 2 only
:       4. grep -i "3ho/3ha(*) 4s" ships,   showed nothing
:       5. grep -i "3ho/3ha(*) 4s" ships,   showed nothing
:       6. grep -i "3ho/3ha(p*) 4s" ships,  showed nothing

Remember that regular expressions and filename globbing are different things.
You were attempting filename globbing, when grep requires a regular expression.
Try this:

grep -i "3ho/3ha.* 4s" grepp

The ".*" does what you were trying to do with the "*", which is match a string
of 0 or more characters.

Beirne

--
Beirne Konarski         | Subscribe to the Unicycling Mailing List

Kent State University   | Unicycling Web Page:
"Untouched by Scandal"        | http://nimitz.mcs.kent.edu/~bkonarsk/

2. moving from one drive to another

3. Use of grep and awk commands with iostat and mail commands

4. Linux news group

5. grep sTerm * | grep -v grep ???

6. change MAC address

7. tail | grep | grep | grep

8. Solaris Certification

9. TAR command 2GB limitation

10. Limitation on size of command-line arguments

11. TAR command 2GB limitation

12. grep command .sh_history

13. Do command when tail -f some_file | grep some_exp, matches?