# Help with filter result (scientific notation) by using awk

**URL:** <https://community.unix.com/t/help-with-filter-result-scientific-notation-by-using-awk/351806>\
**Category:** Shell Programming and Scripting\
**Created:** [April 8, 2015, 11:14am UTC](https://community.unix.com/t/help-with-filter-result-scientific-notation-by-using-awk/351806 "2015-04-08T11:14:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpp\_beginner](https://community.unix.com/letter_avatar/cpp_beginner/32/6_22734026db12803ebb3e059622ac3534.png) [@cpp\_beginner](https://community.unix.com/u/cpp_beginner)\
**Post date:** [April 8, 2015, 11:14am UTC](https://community.unix.com/t/help-with-filter-result-scientific-notation-by-using-awk/351806/1 "2015-04-08T11:14:46Z")

</div>

Input file:

```nohighlight
data1 0.05
data2 1e-14
data1 1e-330
data2 1e-14
data5 2e-60
data5 2e-150
data1 4e-9

```

Desired output:

```nohighlight
data2 1e-14
data1 1e-330
data2 1e-14
data5 2e-60
data5 2e-150

```

I would like to filter out those result that column 2 is less than 1e-10.  
Command try:

```nohighlight
awk '($2 <"1e-10") {print $0}' input_file

```

I not too sure why the above code no work for certain record that got very small scientific notation in column 2.

Thanks for any advice.

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_22734026db12803ebb3e059622ac3534.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [April 8, 2015, 11:31am UTC](https://community.unix.com/t/help-with-filter-result-scientific-notation-by-using-awk/351806/2 "2015-04-08T11:31:36Z")

</div>

You are comparing them as strings, not numbers. Convert $2 to a number by adding 0 to it, and don't quote your own value.

```nohighlight
awk '($2 + 0) < 1E-10' inputfile

```

You don't need a { print $0 } block. If you leave it off, that's what awk assumes you'd do anyway.
