Friday, 15 June 2012

bash - Keeping only values that match regex in file -



bash - Keeping only values that match regex in file -

i trying modify file using sed in bash script

the file has format like:

asfdsdfad..... : 4.12 aldkfjsadk.... : 3.90 asdlkfjasd.... : 2.33

i want modify file contain numbers, including decimal.

a regex of want maintain [0-9].[0-9][0-9]

currently have been trying utilize sed s/[regex]//g however, having problem finding right regex inverse. either need find right regex inverse of above regex, or have command maintain regex, instead of remove it.

thanks in advance

you seek next regex, remove until number.

sed 's/^[^0-9]\+//' file

regex bash sed

No comments:

Post a Comment