# Find line number of bad data in large file

**URL:** <https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789>\
**Category:** Shell Programming and Scripting\
**Created:** [January 14, 2011, 11:55am UTC](https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789 "2011-01-14T11:55:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pchang](https://community.unix.com/letter_avatar/pchang/32/6_22734026db12803ebb3e059622ac3534.png) [@pchang](https://community.unix.com/u/pchang)\
**Post date:** [January 14, 2011, 11:55am UTC](https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789/1 "2011-01-14T11:55:57Z")

</div>

Hi Forum.

I was trying to search the following scenario on the forum but was not able to.

Let's say that I have a very large file that has some bad data in it (for ex: 0.0015 in the 12th column) and I would like to find the line number and remove that particular line.

What's the easiest way to do so?

For a smaller file, I could use the "vi editor", edit the file, search for the bad data in the specific column and then just delete the row.

But for a larger file where using the "vi editor" is out of the question.

Cannot really use the grep -v "0.0015" option since "0.0015" value could be valid for other rows and which is not in the 12th column.

I do not know what is the line number where the bad data resides.

Thanks.

---

<div class="post-metadata">

**Author:** ![joeyg](https://community.unix.com/user_avatar/community.unix.com/joeyg/32/780_2.png) [@joeyg](https://community.unix.com/u/joeyg)\
**Post date:** [January 14, 2011, 12:02pm UTC](https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789/2 "2011-01-14T12:02:00Z")

</div>

Take a look at this similar request:

> **[awk : deleting specific incorrect lines](https://www.unix.com/shell-programming-and-scripting/151919-awk-deleting-specific-incorrect-lines.html)**
>
> Hello friends, I searched in forums for similar threads but what I want is to have a single awk code to perform followings; I have a big log file going like this; pre { overflow:scroll; margin:2px; pa | The UNIX and Linux Forums

---

<div class="post-metadata">

**Author:** ![vgersh99](https://community.unix.com/user_avatar/community.unix.com/vgersh99/32/14851_2.png) [@vgersh99](https://community.unix.com/u/vgersh99)\
**Post date:** [January 14, 2011, 12:02pm UTC](https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789/3 "2011-01-14T12:02:17Z")

</div>

Assuming your columns are space/tab separated

```nohighlight
nawk '$12 != 0.0015' myFile

```

---

<div class="post-metadata">

**Author:** ![anurag.singh](https://community.unix.com/letter_avatar/anurag.singh/32/6_22734026db12803ebb3e059622ac3534.png) [@anurag.singh](https://community.unix.com/u/anurag.singh)\
**Post date:** [January 14, 2011, 12:02pm UTC](https://community.unix.com/t/find-line-number-of-bad-data-in-large-file/280789/4 "2011-01-14T12:02:32Z")

</div>

```nohighlight
awk '$12 != 0.0015' inputFile

```
