How to add line number for output, prompt for line, then act based on input?
Solution 1:
nl prints line numbers:
ls | grep android | nl
Solution 2:
If you pipe the result into cat
, you can use the -n
option to number each line like so:
ls | grep "android" | cat -n