unix - Grep two lines with unique keyword -


i take txt file , sort of grep command , save output file used in r. consider have following log file:

current_t: 178.027  (filename: c:/buildslave/unity/build/artifacts/generated/common/runtime/unityenginedebugbindings.gen.cpp line: 37)  rv: -8.421698e-06  (filename: c:/buildslave/unity/build/artifacts/generated/common/runtime/unityenginedebugbindings.gen.cpp line: 37)  nullreferenceexception: object reference not set instance of object @ modelactions.update () [0x00000] in <filename unknown>:0   (filename:  line: -1)   current_t: 179.7662  (filename: c:/buildslave/unity/build/artifacts/generated/common/runtime/unityenginedebugbindings.gen.cpp line: 37)  rv: -8.413203e-06  (filename: c:/buildslave/unity/build/artifacts/generated/common/runtime/unityenginedebugbindings.gen.cpp line: 37) 

i want able grab each line has current_t , rv. preferably have output as:

178.027  -8421698e-06 179.7662  -8.413203e-06 

where times placed in column , rv placed in following column. there grep command me this? thanks!

awk rescue!

$ awk -f: '$1~/current_t/{ct=$2} $1~/rv/{print ct, $2}' file             178.027  -8.421698e-06  179.7662  -8.413203e-06 

assumes data has matching pairs.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -