Extract data between two characters

Hi,

how can i extract a data between two characters

input file is

abc  efg hig  - 99.4% (16337276 kB) used
efg klm - 47.1% (7734968 kB) used 
hij - 99.4% (16341464 kB) used
klm -93.7% (15394516 kB) used

output should be

99.4
47.1
99.4
93.7

thanks in advance

Try This.

Input file name - test.txt
script name - extract.pl

perl extract.pl test.txt

#!/usr/bin/perl

while (<>) {
if (/\-\s(.+?)\%/) { print $1,"\n"; }
}
sed 's/.*-[ ]*\([0-9.]*\)%.*/\1/g' input.txt

Thanks pravin it worked , is there any way to do this by using bash instead of perl

---------- Post updated at 02:14 AM ---------- Previous update was at 02:11 AM ----------

Thanks sed command worked for me ..

Try this

grep  "[0-9]*\.[0-9]%" -o  <filename> 

Put this line in to a bash script

sed 's/.*- *//;s/%.*//' infile
awk -F "[-%] *" '{print $2}' infile