Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Silly Perl Tricks
# remove a string from all lines in a file
cat thing-groups.csv | perl -ne 's/,SmartGroup//g; print $_' -
# just the ones with that smartgroup, but remove it
cat thing-groups.csv | perl -ne 'while(/(.*),SmartGroup(.*)/g){ print "$1$2\n" };' -
# just the ones with that smartgroup, but make it the last one
cat thing-groups.csv | perl -ne 'while(/(.*)(,SmartGroup)(.*)/g){ print "$1$3$2\n" };' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.