On 06/15/2014 03:05 AM, David Kirkby wrote:
> Is there any way to print the file, copying the lines that are different (in this case starting with "! Time", but not totally screwing up the order of the file?
>
> I wan something that looks like this.
>
> ! This is a touchstone format file.
> ! It should be saved with .s2p extension
> ! HEWLETT PACKARD,8720D,0,7.74
> ! Date = 6 Jun 2014
> ! Time = 13:24:28
> ! Time = 13:24:28
> ! Start frequency = 0.050000000 GHz
> ! Stop frequency = 7.000000000 GHz
You could read
$(diff -U 4294967295 j.s11.s2p j.s22.s2p|tail -n +4)
in a loop and output ${line:1}. The output of 'diff' alone is
--- j.s11.s2p 2014-06-15 05:45:08.800210040 -0700
+++ j.s22.s2p 2014-06-15 05:17:08.131217317 -0700
@@ -1,7 +1,7 @@
! This is a touchstone format file.
! It should be saved with .s2p extension
! HEWLETT PACKARD,8720D,0,7.74
! Date = 6 Jun 2014
-! Time = 13:24:07
+! Time = 13:24:28
! Start frequency = 0.050000000 GHz
! Stop frequency = 7.000000000 GHz
So you would be skipping the first three lines and the first column of
each line, producing:
! This is a touchstone format file.
! It should be saved with .s2p extension
! HEWLETT PACKARD,8720D,0,7.74
! Date = 6 Jun 2014
! Time = 13:24:07
! Time = 13:24:28
! Start frequency = 0.050000000 GHz
! Stop frequency = 7.000000000 GHz
Frank