Mailinglist Archive: opensuse (1599 mails)

< Previous Next >
Re: [opensuse] Re: Where is the USB hd?
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Sun, 11 Oct 2009 15:19:29 +0200 (CEST)
  • Message-id: <alpine.LSU.2.00.0910111517170.28296@xxxxxxxxxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Sunday, 2009-10-11 at 08:38 -0400, Adam Tauno Williams wrote:

nimrodel:~ # cat /proc/partitions | grep -e "sd\?"
major minor #blocks name
8 0 1993728 sda
8 1 1993608 sda1
nimrodel:~ #
Now, I wonder why the header line got through the grep... useful, but I
don't know why :-?

The question mark matches *zero* or one of the *preceding* element.

Hence the "s" in "blocks" matches the provided regular expression: "s"
followed by *zero* or one "d".

Ah! I see. I need to use a dot instead:

nimrodel:~ # cat /proc/partitions | grep -e "sd."
8 0 1993728 sda
8 1 1993608 sda1

or, perhaps, this:

nimrodel:~ # cat /proc/partitions | grep -e "sd.\|#blocks"
major minor #blocks name
8 0 1993728 sda
8 1 1993608 sda1


- -- Cheers,
Carlos E. R.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkrR22MACgkQtTMYHG2NR9VZLQCeOS6C0Mnw62mz5nxU9CN7m3p8
My4An0O6XE83UZXuK9waw0ZarFziv9vt
=A+1J
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >