Extracting content from a file in specific format

Hi All,

I have the file in this format

**** Results Data ****

Time or Step
1
2
20


0.000000000e+00     0s    0s    0s
1.024000000e+00     Us    0s    0s
1.100000000e+00     1s    0s    0s
1.100000001e+00     1s    0s    1s
2.024000000e+00     Us    Us    1s
2.024000001e+00     Us    Us    0s
2.100000000e+00     0s    1s    0s
2.100000001e+00     0s    1s    1s
3.024000000e+00     Us    1s    1s
3.024000001e+00     Us    1s    0s
3.100000000e+00     1s    1s    0s

**** Statistics ****

Operating point analog/event alternations:  1
Operating point load calls:                 4
Operating point event passes:               2
Transient analysis load calls:              84
Transient analysis timestep backups:        0

I have to extract only the the content in bold format.

Thanks in Advance

 
awk '$0~/^[0-9].*s$/' input.txt
1 Like

Hi

 awk '/^[0-9].*s$/' file
1 Like

Thanks a lot for your help.
One more help is required

0.000000000e+00 0s 0s 0s
1.024000000e+00 Us 0s 0s
1.100000000e+00 1s 0s 0s
1.100000001e+00 1s 0s 1s
2.024000000e+00 Us Us 1s
2.024000001e+00 Us Us 0s
2.100000000e+00 0s 1s 0s
2.100000001e+00 0s 1s 1s
3.024000000e+00 Us 1s 1s
3.024000001e+00 Us 1s 0s
3.100000000e+00 1s 1s 0s

I want just the final stable result for time 0,1,2 and 3 in bold line.
In between this (no matter how many times it repeat) is not required.

Thanks!!!!!!!!!

Try:

awk -F. '/^[0-9].*s/{if($1!=n)print p; p=$0; n=$1}END{print p}' infile

--
Please view this link to learn the use of code tags.

Can we include the term of 0 line in bold ?

I made a small correction in my post right after I posted. Perhaps you tried the first (wrong) version? Could you test with the version that you see right now?

1 Like

Yeah thats working fine.......Thanks a lot:):b:

---------- Post updated at 05:16 AM ---------- Previous update was at 05:14 AM ----------

Thanks a .........its working fine man:)