Results 1 to 3 of 3
Hello! I've been trying to figure out a few things with grep and uniq but I'm really stuck now and would really need some help. 1. I'm trying to grep ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-25-2012 #1
- Join Date
- Sep 2012
I need some help with grep and uniq
I've been trying to figure out a few things with grep and uniq but I'm really stuck now and would really need some help.
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.
3. I have a file containing two rows of words, and it looks something like this:
Now, what I want to do is to sort out all words that are the same, but have different word classes. So 'cat', 'dog' and 'eat' should be sorted out since both are nouns, Which means I want the output to be:
I've tried using uniq and sort in every way i could think of, but I still can't sort this out. There's a TAB between the words, if the cut command could be of any help.
Help is very appreciated!!
- 09-30-2012 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
Stupid question, but is this a class/school exercise/problem?Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-30-2012 #3
Until I hear whether or not this is homework, I'm going to withhold too much detail, but my main question is: why don't you want to use grep -v?