Skip to content

Instantly share code, notes, and snippets.

@pfigue
Created March 18, 2015 12:44
Show Gist options
  • Save pfigue/66a195e6fefc86c2374e to your computer and use it in GitHub Desktop.
Save pfigue/66a195e6fefc86c2374e to your computer and use it in GitHub Desktop.
Perl one-liners for the command line

Taking groups inside of a line

From a bunch of lines like Conf e2fslibs (1.42.9-3ubuntu1.2 Ubuntu:14.04/trusty-updates [amd64]) [e2fsprogs:amd64 ] I want to get e2fslibs. apt-get upgrade --dry-run gives such kind of lines.

perl -pe 's/^Conf\s(\S+)\s.*$/$1/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment