Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> I need help with grep
Roadhouse
post Sep 25 2012, 06:50 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 25-September 12
Member No.: 17,857



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!
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
mogwin
post Nov 21 2012, 02:39 PM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 6
Joined: 21-November 12
Member No.: 17,973



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]"
Go to the top of the page
 
+Quote Post

Posts in this topic
- Roadhouse   I need help with grep   Sep 25 2012, 06:50 AM
- - mogwin   Number 1 would best be accomplished by piping one ...   Nov 21 2012, 02:39 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 12th December 2017 - 07:20 AM