Greetings. The compiler I've been using recently very helpfully provides the line number *and* column number in warnings and error messages. I would like to be able to search a file and see both numbers. Note that I am not interested in doing this within any particular editor--I imagine it is possible and done differently for every editor family. I want a standalone solution independent of editor.
Grep has a line number option but not column number option. I spent a while searching the WWW to no avail, but I have come up with an awk solution. ls | awk '/er.*/ {match($0, /er.*/); print $0; print NR":"RSTART"-"RSTART+RLENGTH}' debfoster-a-notes.txt 3:8-22 vdirsyncer 21:9-11 So there is a match on line 3 columns 8-22 and line 21 columns 9-11. Exactly what I want. I am curious though, is there a "better" way? A version of grep that has a column number option? Are just a simpler way of achieving this goal?