find ./someJavaDir/ -type f -name '*.java' \-exec grep '^import .*$' '{}' \; | \sort | uniq | sort | awk '/import/ {print $2 }'
Basically, replace ./someJAVADir/ with the actual directory that you would like to search for JAVA imports.
find ./someJavaDir/ -type f -name '*.java' \-exec grep '^import .*$' '{}' \; | \sort | uniq | sort | awk '/import/ {print $2 }'
#!/usr/bin/perl -w
use strict;
use XML::Simple;
use Data::Dumper;
my $xml = <<EOF;
<fullletter>
<CASE_EPIS>00036</CASE_EPIS>
<letter>
<IMAGENAME>02_20100423124541</IMAGENAME>
<RUNDATE>2010-04-23 12:04:41</RUNDATE>
<LETTERTYPE>LOI2</LETTERTYPE>
</letter>
<service> </service>
<service>
<NTV_SEQUENCE>26</NTV_SEQUENCE>
<NTV_DISPLAY_VALUE>Need start date </NTV_DISPLAY_VALUE>
</service>
<service> </service>
</fullletter>
EOF
# use XML simple to process the XML
my $xs = XML::Simple->new(
# remove extra whitespace
NormaliseSpace => 2,
# keep root element
KeepRoot => 1,
# force elements to arrays
ForceArray => 1,
# ignore empty elements
SuppressEmpty => 1
);
# read in the XML
my $ref = $xs->XMLin($xml);
# print out the data structure
# shows you how to access the data
print Dumper($ref);
# print out the XML minus the empty tags
print $xs->XMLout($ref);Running this sample code then produces (minus the Data::Dumper text):<fullletter>
<CASE_EPIS>00036</CASE_EPIS>
<letter>
<IMAGENAME>02_20100423124541</IMAGENAME>
<LETTERTYPE>LOI2</LETTERTYPE>
<RUNDATE>2010-04-23 12:04:41</RUNDATE>
</letter>
<service>
<NTV_DISPLAY_VALUE>Need start date</NTV_DISPLAY_VALUE>
<NTV_SEQUENCE>26</NTV_SEQUENCE>
</service>
</fullletter>
Here is a little snippet that allows you to post to your Blogger blog from Perl:
use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
'smtp.gmail.com', # dont change
Hello => 'smtp.gmail.com', # dont change
Port => 587, # dont change
User => 'your.address@gmail.com', # change to your username
Password => 'password' # change to your password
);
# you email address associated with the blog
$mailer->mail('your.address@gmail.com');
# the address to send the post to
$mailer->to('blogid.secretword@blogger.com');
$mailer->data;
# blog post body
$mailer->datasend("Subject: Title of my blog post\n\n")
; # keep the trailing \n\n!
$mailer->datasend("The text of my post here\n");
# end blog post
$mailer->dataend;
$mailer->quit;
Let me know how this works for you!