Skip to content

Instantly share code, notes, and snippets.

@jalexandre0
Created May 21, 2013 14:48
Show Gist options
  • Save jalexandre0/5620380 to your computer and use it in GitHub Desktop.
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)
#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