* Re: [gentoo-user] sed/awk question
@ 2011-11-22 4:49 99% ` Benjamin Lee
0 siblings, 0 replies; 1+ results
From: Benjamin Lee @ 2011-11-22 4:49 UTC (permalink / raw
To: gentoo-user; +Cc: Adam Carter
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]
On 11/21/2011 06:52 PM, Adam Carter wrote:
> Hi All,
>
> I need to cut a string, which happens to be a filename, using the
> first dash that's followed by a numeral, so cut -f 1 -d"-" fails if
> the filename has an extra dash. How do i do this?
Here's a Bourne parameter expansion:
blee@eclipse ~ $ foo="net-snmp-5.3.2.2-5.cp843034001.i386.rpm"
blee@eclipse ~ $ echo ${foo%%-[0-9]*}
net-snmp
--
Benjamin Lee
http://www.b1c1l1.com/
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2011-11-22 2:52 [gentoo-user] sed/awk question Adam Carter
2011-11-22 4:49 99% ` Benjamin Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox