Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • Two things: 1) I'm not a perl regex person, but shouldn't you be anchoring the 1 to the beginnin of the line so that you don't get false positives for urls with embedded 1?; 2) Because this answer is a bit complex, and the questioner probably wants something more generally useful, how about replacing 1 with a shell variable and prefixing the grep command with setting that variable, ie. something like i=1 grep --perl-regexp --only-matching "(?<=^${i}\. ).*" hello Commented Jan 25, 2018 at 22:43