Skip site navigation (1)Skip section navigation (2)
Date:      2 Jul 2010 00:19:43 -0000
From:      John Levine <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Cc:        aiza21@comclark.com
Subject:   Re: Bourne .sh ?
Message-ID:  <20100702001943.37629.qmail@joyce.lan>
In-Reply-To: <4C2D2839.3040909@comclark.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <4C2D2839.3040909@comclark.com> you write:
>I have a file containing this
>
>drwxrwxr-x  14 89987  546  512 Jun  6  2009 7.2-RELEASE
>drwxrwxr-x  14 89987  546  512 Mar 23 04:59 7.3-RELEASE
>drwxrwxr-x  13 89987  546  512 Nov 23  2009 8.0-RELEASE
>drwxrwxr-x  13 89987  546  512 Jul  1 04:56 8.1-RC2
>
>I want to strip off everything to the left of the release
>version so I end up with this.
>
>7.2-RELEASE
>7.3-RELEASE
>8.0-RELEASE
>8.1-RC2
>
>How would I code to do this?

sed -e 's/.* //' firstfile > secondfile

awk '{ print $9}' firstfile > secondfile


There are far more complicated methods, too.

R's,
John



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100702001943.37629.qmail>