Afficher un message
Vieux 31/10/2006, 20h19   #6
transmute70@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Using the grep command to filter

Wow, thanks everyone for your responses! Sorry for not getting back to
you sooner about my trials and tribulations with this question (not to
mention the rest of them).

I hope no one is offended when I say I have no clue what many of you
were referring to, however, I was able to pull some information from
your responses, such as wc, a head command, etc.

My lab partners and I came up with the following mess (I'm embarassed
because it doesn't even work right, but we were on a deadline and this
was as close as we got:

:~$ rgrep -s -i -c ubuntu /etc/ | awk -F: '{print $2 "\t" $1}' | sort
-rn | head -n5 | awk '{print $2}'

Now, this command never succesfully worked as far as I saw, my shell
window just sorta sat there and did nothing, so I am not sure if it was
trying to interpret the command or didn't like it. However, when we
tried it using a different (and smaller directory), the command line
worked, as seen below.

~$ rgrep -s -i -c ubuntu /etc/apt | awk -F: '{print $2 "\t" $1}' | sort
-rn | head -n5
15 /etc/apt/sources.list
2 /etc/apt/trusted.gpg~
2 /etc/apt/trusted.gpg
2 /etc/apt/apt.conf.d/50unattended-upgrades
0 /etc/apt/apt.conf.d/70debconf

:~$ rgrep -s -i -c ubuntu /etc/apt | awk -F: '{print $2 "\t" $1}' |
sort -rn | head -n5 | awk '{print $2}'
/etc/apt/sources.list
/etc/apt/trusted.gpg~
/etc/apt/trusted.gpg
/etc/apt/apt.conf.d/50unattended-upgrades
/etc/apt/apt.conf.d/70debconf

So, there you have it, the fruit of our labors! I am sure ther are more
effcient ways of doing this...specifically the professor mentioned
piping to grep two times, but I think it is obvious, we never figured
that particular method out.

I really appreciate eveyone's input, thanks again!
D

  Réponse avec citation
 
Page generated in 0,05690 seconds with 9 queries