File Format Help

I run a command,(EMC Celerra replication status), and it prints in specific format. I would like to re-format to read better. Any help is appreciated.

FROM:

Name = Job1
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job2
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job3
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job4

TO:

Name Last Sync Time
Job1 Mon Aug 22 16:38:32 EDT 2011
Job2 Mon Aug 22 16:38:32 EDT 2011
Job3 Mon Aug 22 16:38:32 EDT 2011
Job4 Mon Aug 22 16:38:32 EDT 2011

Thanks in advance.

Cheers, LA:)

Hi,

Using 'perl':

$ cat infile
Name = Job1
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job2
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job3
Last Sync Time = Mon Aug 22 16:38:32 EDT 2011
Name = Job4
$ cat script.pl
use warnings;
use strict;
use autodie;

my @data;

@ARGV == 1 or die qq(Usage: perl $0 file\n);

while ( <> ) {
        chomp;
        my @f = split /\s*=\s*/;

        printf "%s " . ( ($. == 2) ? "\n" : "" ), $f[0] if $. <= 2;

        push @data, $f[1];

        if ( $. % 2 == 0 ) {
                printf "%s\n", "@data";
                @data = ();
        }

}
$ perl script.pl infile
Name Last Sync Time 
Job1 Mon Aug 22 16:38:32 EDT 2011
Job2 Mon Aug 22 16:38:32 EDT 2011
Job3 Mon Aug 22 16:38:32 EDT 2011

Regards,
Birei

$ awk ' BEGIN {FS="=";ORS=""} {if(NR%2){print $2} else{print $2"\n"}}' /tmp/90

Job1 Mon Aug 22 16:38:32 EDT 2011
Job2 Mon Aug 22 16:38:32 EDT 2011
Job3 Mon Aug 22 16:38:32 EDT 2011

where /tmp/90 is the input file which has the following lines:

 
$ nawk -F"=" '{if(NR%2){a=$2;getline;printf("%s %s\n",a,$2) }}' input
Job1  Mon Aug 22 16:38:32 EDT 2011
Job2  Mon Aug 22 16:38:32 EDT 2011
Job3  Mon Aug 22 16:38:32 EDT 2011

one more way

$ echo " Name   Last Sync Time";echo "`awk -F= ' { print $2 } ' inputfile | paste - -`"

Through Sed..

 
sed -n '1{N;s/\(.*\) = \([^\n]*\)\n\(.*\) = \(.*\)/\1 \3 \n\2 \4/p}
        3,${N;s/.*= \([^\n]*\).*= \(.*\)/\1 \2/p}' inputfile

Alternate awk..

awk -F"=" '{print /Name/?$2:$2"\n"}' ORS= inputfile

You guys awesome. I am going to check all of the solutions. thanks.

I tested all of the suggestions and all of 'em work. While it provides the output, I want to slightly adjust the format as below.

Name Last Sync Time
Job1 Thu Aug 25 11:00:17 EDT 2011
Job2 Thu Aug 25 11:00:17 EDT 2011

I just want all the "Last Sync Time" to start at the same column number.

I tried \t with what you guys provided, but I couldn't make it work.

Cheers, LA:D

---------- Post updated at 12:49 PM ---------- Previous update was at 12:41 PM ----------

Let me try with "shift".

If im not wrong, doesn't the above solutions' output start with same column as you required.. the sed,perl or awk solution..? Please re-check on Perl or Sed solution.

Right now, with all the solutions, output is like this.

Name Last Sync Time
Job1 Thu Aug 25 11:00:17 EDT 2011
Job2 Thu Aug 25 11:00:17 EDT 2011
Job3 Thu Aug 25 11:00:17 EDT 2011
Job4 Thu Aug 25 11:00:17 EDT 2011

I just want the "Last Sync Time" to start the same column.