-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Oct 16, 2015 at 02:54:25PM +0200, Nemeth Gyorgy wrote: > 2015-10-16 14:15 keltezéssel, Alfred Charles Stockton írta: > > > > If I issue the command cat /etc/*-release on my Debian system I get:- > > > > PRETTY_NAME="Debian GNU/Linux 8 (jessie)" > > NAME="Debian GNU/Linux" > > VERSION_ID="8" > > VERSION="8 (jessie)" > > ID=debian > > HOME_URL="http://www.debian.org/" > > SUPPORT_URL="http://www.debian.org/support/" > > BUG_REPORT_URL="https://bugs.debian.org/" > > > > Now what I would like to do is to only print the substring "Debian > > GNU/Linux 8 (jessie)" from the 1st line, preferably in bash. > > > > Please tell me how I should go about this? > > > > -- > > Regards, > > Alf Stockton > > > > > > > cat /etc/*-release | grep ^PRETTY_NAME | sed 's/^.*=//'
Many insightful answers have been given. Yours is an example of "useless use of cat" [1], better spelt as grep ^PRETTY_NAME /etc/*-release | sed 's/^.*=//' Even better, since sed can do grep: sed -ne '/^PRETTY_NAME=/ s/^.*=// p' < /etc/*-release [1] <http://uselessuseofcat.com/> regards - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlYg+DYACgkQBcgs9XrR2kYxKACdHFb8xn/cjQU5of0vsRmxnUXZ INAAnA3MxfnslHQPQ0Cw9TIOwWxcpI7F =xsvX -----END PGP SIGNATURE-----