* lynn <lynn@steve-ss.com> [120213 00:40]:
On 02/13/2012 12:05 AM, lynn wrote:
I'm regex'd out of it at the moment. Given a string like this:
lynn:*:3000002some other stuff100hellolynn:
Is there a way to get the 3000002 into a variable v1 and the 100 into a variable v2? bash? Any recommended starting point? Thanks, L x
Thinking out loud: v1="lynn:*:3000002some other stuff100hellolynn:";echo "${v1//[!0-9]}" gives: 3000002100
But I may have: lynn2:*:3000002some other stuff100hellolynn: which gives: 23000002100
How to select only the 3000002 Thanks --
Does it have to be grep, sed and awk? cut -c 9-15 awk -F\: '{print $3}' |cut -c 1-7