Help - Search - Members - Calendar
Full Version: I need help with grep
Linuxhelp > Support > Technical Support
Roadhouse
Hi!
I've been trying to figure out a few things with grep but I'm really stuck now.

1. I'm trying to grep anything that starts with an "a", but doesn't have any more "a":s. Which means that grep would show me words like "and", but not words like "america".

2. I'm trying to grep anything that doesn't contain "a" at all. I know it's easily done by using "grep -v a". However, I'm trying to do this without using "-v". I've tried things like "grep [^a]", but that would only remove things that contain "a" only. I've tried using * and .* but it doesn't help me at all.

Help is very appreciated!
mogwin
Number 1 would best be accomplished by piping one grep to another:
grep ^[aA] ./filename | grep -v [aA].*[aA]

Number 2 would best be accomplished by using the -v option. Why are you trying to avoid using "grep -v [aA]"
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.