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:
M 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):
^/home/user/.netscape/cache| \
^/home/user/devl/kr/src/kernel-source-2.6.8| \
^/home/user/dwn| \
^/home/user/.opera/cache| \
lost\+found| \
^/home/user/.gnome2/epiphany/mozilla/epiphany| \
^/home/user/.galeon/mozilla/galeon/Cache| \
^/home/user/.mozilla/default/w2u0h33y.slt/Cache
Then:
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.
Spammers! http://www.spots.ab.ca/~keeling/emails.html
.
- References:
- Re: GREP Help
- From: Garry Knight
- Re: GREP Help
- From: Lew Pitcher
- Re: GREP Help
- 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
- Index(es):
Relevant Pages
|