On 11/12/2013 02:56 AM, Alex Naysmith wrote: > From the nvidia install procedure is the following command: > > # aptitude -r install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') > nvidia-kernel-legacy-173xx-dkms > > I can see the pipe | symbol and the regular expressions but I don't > really understand what this command is doing.
It installs the linux headers related to the currently running kernel. It takes the output of "uname -r" and pipes it to sed. Sed is doing a substitution, replacing the version numbers with nothing. For example, on my lubuntu system: paul@Serenity:~$ uname -r 3.11.0-13-generic paul@Serenity:~$ uname -r | sed 's,[^-]*-[^-]*-,,' generic paul@Serenity:~$ echo linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') linux-headers-generic I used echo instead of aptitude, since I don't want to actually install the package. From: http://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html "The syntax of the s (as in substitute) command is ‘s/regexp/replacement/flags’." From: http://www.grymoire.com/Unix/Sed.html#uh-6 I believe [^-] in the regular expression means globally match anything except a dash. I'm a little weak on sed (and awk), so I might be a little off on the specifics. I'm sure others will correct/elaborate for me. :) - PaulNM > > > Alex -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/5281ef6e.6080...@paulscrap.com