Skip to content

Instantly share code, notes, and snippets.

@betawaffle
Created May 13, 2011 18:07
Show Gist options
  • Save betawaffle/971012 to your computer and use it in GitHub Desktop.
Save betawaffle/971012 to your computer and use it in GitHub Desktop.
Linear Regex Replaces with Perl
#!/usr/bin/perl -w
use strict;
while (<>) {
s/\t/|/g; # Convert Tabs to Pipes
s/\r?\n/[]\r\n/g; # Add [] at EOL and Convert to CRLF
s/^\|+\[\]\r\n//g; # Remove Empty Lines
print;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment