Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2010 20:49:14 -0400
From:      "b. f." <bf1783@googlemail.com>
To:        Aiza <aiza21@comclark.com>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: Bourne .sh ?
Message-ID:  <AANLkTike3XX-sXiGM1LrMNpmjJ5rRGwB2tHpgbQ7DIIw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
>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?

By using something like:

awk '{print $9}' nameofmyfile

(Or whatever column it is, if not the ninth.)  Or you can use sed(1).
Or cut(1).  Or colrm(1)...

I'd recommend first reading some of the base system manpages, and
tutorials on basic text processing tools and shell programming than
can be found in many places on the web, before addressing a lot of
questions like this to a FreeBSD-specific list.

Regards,
               b.



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