Question: I want to get the versionName from the AndroidManist.xml file with a shell command.
I've been trying to use grep and with:

```
 grep versionName ./AndroidManifest.xml

```

I'm getting this line: 

```
android:versionName="1.0">

```

Is it possible to narrow it down to **1.0** somehow?

Thanks in advance

Answer: 
Try this :

```
perl -e 'while($line=<>) { if ($line=~ /versionName\s*=\s*"([^"]+)"/) { print "$1\n";}}' <AndroidManifest.xml

```

You may want to put this into a file :

Ex: VersionNum.pl

```perl
#!/usr/bin/perl

#get the filename from command line
$file = shift or die;

#open the file and read it into $lines var
open(IN,$file) or die;
$lines=join("",<IN>); 
close(IN);

#search the $line var for match and print it
if ($lines =~ m/android:versionName\s*=\s*"([^"]+)"/mgs)  {
   print "$1\n";
}

```

Then simply `chmod 755 VersionNumber.pl` and use it with `VersionNumber.pl AndroidManifest.xml`
A shorter version could be derived from your original suggestion:

```
grep versionCode AndroidManifest.xml | sed -e 's/.*versionName\s*=\s*\"\([0-9.]*\)\".*/\1/g'

```