bash - How to extract numbers and special characters in a string in linux script -
i have string basedir=/cp/osp/peaker/1543.23. here want extract 1543.23, in linux script, tell me how here.
may using sed, regex, unable do. here want 1543.23 (so want number , special character . also).
you use awk
. like
echo $basedir | awk 'begin {fs="/"};{print $nf}'
that begins setting field separator (fs) "/" , printing last field.
Comments
Post a Comment