Hello

I have a string "c0024"

How can i get rid of non numeric digits, so i am left with

0024

removed "c"

I cannot think of a way of doing this

var="c0024"
var2=`echo ${var} | sed -e 's/[^0-9]//g'`

Hello

I have a string "c0024"

How can i get rid of non numeric digits, so i am left with

0024

removed "c"

With bash/ksh93 and zsh:

% s="c0024"
% echo "${s//[^0-9]}"
0024
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.