Re: [dev] show line number *and* column number in a search

From: Marc Chantreux <mc_AT_unistra.fr>
Date: Sat, 2 Jul 2022 16:02:50 +0200

On Mon, Jun 20, 2022 at 09:02:13AM -0400, Greg Reagle wrote:
> On Mon, Jun 20, 2022, at 3:00 AM, mb_AT_datameer.com wrote:
> > "Greg Reagle" <list_AT_speedpost.net> wrote:
> >> ls | awk '/er.*/ {match($0, /er.*/); print $0; print NR":"RSTART"-"RSTART+RLENGTH}'
> > [0] https://geoff.greer.fm/ag/

you don't need match twice so

        awk ' match($0, /er.*/) { print $_"\n"NR":"RSTART"-"RSTART+RLENGTH }'

does the trick.

regards
-- 
Marc Chantreux
Direction du numérique de l'Université de Strasbourg
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200
Received on Sat Jul 02 2022 - 16:02:50 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 02 2022 - 16:48:08 CEST