You can also use the function bolp:
bolp is a built-in function in `../editfns.c'.
Return t if point is at the beginning of a line.
This function does
not change global state, including the match data.
Usually you get a buffer position via (point), thus simply issuing (bolp) will be enough. If the point has been moved, use goto-...
For a faster method to get line number at position -- (with-current-buffer BUFFER (goto-char POSITION) (string-to-number (format-mode-line "%l"))) -- see the following thread, which cites some limitations / disadvantages in the comments:
A faster method to obtain `line-number-at-pos` in large buffers
The traditional method is to use line-number-at-pos, ...
Try delete-duplicate-lines, which is part of distributed Emacs.
Emacs Wiki page Duplicate Lines might help.
It points to a blog post about it.
It explains why interactive search-and-replace might not help.
It explains how to do it with Lisp, in various ways.
It explains how to do it with the UNIX / GNU/Linux command sort or unique.
If you don't need to do this all the time, the quickest solution might be using interactive replacement: query-replace-regexp, bound to C-M-%. Start with point at the top of the buffer.
Note, if you want to delete entire lines, you'll need to include a newline in your regexp. You enter this at the prompt with C-q C-j.
So, for over_second, call C-M-%, then ...