Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] sed/awk question
Date: Tue, 22 Nov 2011 04:55:47
Message-Id: CAC=wYCE+23AJT7vbjeq3iu6f9DC65j4jMc0ky5vNKBitSNjHgw@mail.gmail.com
In Reply to: Re: [gentoo-user] sed/awk question by Joseph Davis
1 > I'd use sed and the regex "-[0-9]" to delimit the field
2 >
3 >
4 > foo=`echo '123--bad-2xyz-3--' | sed -r -e "s/-[0-9].*//"`
5 > echo $foo
6 > 123--bad
7 >
8 >
9 > Helpful?
10
11 Perfect - thanks!