Created
December 19, 2018 15:17
-
-
Save kurtroberts/7ce4644f1060c1eb72e7eb870cc772dc to your computer and use it in GitHub Desktop.
Silly Perl Tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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