Re: GREP Help
- From: "s. keeling" <keeling@xxxxxxxxxxx>
- Date: Thu, 01 Feb 2007 18:42:02 GMT
Lew Pitcher <lpitcher@xxxxxxxxxxxx>:
On Jan 31, 8:20 pm, Garry Knight <garrykni...@xxxxxxx> wrote:
That gives me the lines that do not contain # but I want the lines that do
not begin with it.
Here's another way of doing it:
grep "^[^#]" /etc/my.conf
At 25 characters, both solutions are probably the shortest possible, but Lew
and Sinner's version is easier to type.
Yes, but your solution eliminates empty lines, and that might make the
results more readable.
Just another way to say the same thing, fwiw:
egrep -v '^#|^$' /etc/my.conf
29 chars, and it's a little more extensible. I use the same construct
for deselecting directories/files I don't want in my backups (one honking
long line, artifically broken for posting):
find /somedir -depth -mount | egrep -v "`cat tarX_somedir`" | ...
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling Linux Counter #80292
- - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.
- Prev by Date: Re: GREP Help
- Next by Date: OT: Talking Trash (Microsoft Vista) -- funny.
- Previous by thread: Re: GREP Help
- Next by thread: Re: GREP Help