2020年12月23日星期三

Search and remove floating numbers in scientific form using REGEX and SED

I was working on a solution using shell script (bash) to search floating numbers with exponent reaching more than 3 digits (ex. 11.1234567e+300) and remove the digits after e+.

I was using grep to search for it but im having trouble applying it in SED.

grep -E '([[:digit:]]+[.])[[:digit:]]+[eE][+-][[:digit:]]{3}' filename  

Sample data would be something like below.

COL1,COL2,COL3,COL4  TEXT123,11.12345,12.12345e+300,13.123456  

Any help would be greatly appreciated.

https://stackoverflow.com/questions/65432891/search-and-remove-floating-numbers-in-scientific-form-using-regex-and-sed December 24, 2020 at 09:24AM

没有评论:

发表评论