Gentoo Archives: gentoo-user

From: Pandu Poluan <pandu@××××××.info>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] sed/awk question
Date: Tue, 22 Nov 2011 03:03:37
Message-Id: CAA2qdGWh_5v46vOtQVLaCSH_t8BzxFHJP7GnCrU9Z8b3MPgwfA@mail.gmail.com
In Reply to: [gentoo-user] sed/awk question by Adam Carter
1 On Nov 22, 2011 9:57 AM, "Adam Carter" <adamcarter3@×××××.com> wrote:
2 >
3 > Hi All,
4 >
5 > I need to cut a string, which happens to be a filename, using the
6 > first dash that's followed by a numeral, so cut -f 1 -d"-" fails if
7 > the filename has an extra dash. How do i do this?
8 >
9
10 sed -r -e 's/(.*)-[0-9].*/\1/'

Replies

Subject Author
Re: [gentoo-user] sed/awk question Pandu Poluan <pandu@××××××.info>