Do not waste time with grep anymore, use tag
Long time since my last post. This one is not very technical post, but it’s a nice to have solution if you use grep usually. Are not you fed up to type vim and search the line after a grep command ? If yes, this post is for you.
First of all, you may know that an alternative more user friendly to grep exist, called ag (perf comparison). I really like ag and grep, but something make me loose my time since several years and I’m pretty sure it’s your case too.
Let’s say you generally want to parse files, find the information and jump with vim into it. With tag (using ag only) you can do it in only 2 commands. Let say I want to search my username in /etc:
$ sudo tag pmavro /etc/ /etc/mailname  1:mbp-pmavro /etc/gshadow  18:cdrom:*::pmavro  19:floppy:*::pmavro  22:audio:*::pmavro,pulse  23:dip:*::pmavro  33:video:*::pmavro  35:plugdev:*::pmavro  47:netdev:!::pmavro  53:bluetooth:!::pmavro  54:pmavro:!::  60:docker:!::pmavro
Now if I want to edit /etc/gshadow at line 54 with vim, I only have to type in the terminal:
“e” will read a temporary file containing the result and 10 will ask vim to position in the file to the matching line number.
User friendly and really simple right ?
Hope this will help