Created
May 21, 2013 14:48
-
-
Save jalexandre0/5620380 to your computer and use it in GitHub Desktop.
Collections of perl utils and one-liners
I use this for personal reference (Yep, TDAH)
This file contains hidden or 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
#Open File | |
$input_fh, "<users.txt" or die "Can't open the file" ; close $input_fh ; | |
# Insert lines into array | |
while ( $line = <$input_fh> ) { push @array,$line ; } | |
#Parsing CSV | |
foreach(@array) { | |
chomp $_ ; | |
($user, $password) = split /,/, $_ ; | |
system(zmprov ca $user $password) ; } | |
#Timer: | |
perl -e '$i = 5 ; while( $i-- ) { sleep(1)}; done ' | |
#Print if match: | |
foreach my $field (@array) { if ( $field =~ /mail/ ) { $mail = $field } ; | |
if ( $field =~ /modifyTimestamp/ ) { $date_string = $field } } | |
#Print timestamp | |
perl -e 'print scalar localtime(1355166593);' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment