Skip to main content
1 of 2
bxm
  • 5.2k
  • 1
  • 22
  • 26

You could use awk to process the data and save the different streams to different files.

Assuming the data is in a file called data:

awk '
  $1 ~ /^#INV/
     { gsub(/^#/,"", $1) ; out = $1".out" ; next }
  $1 !~ /^#/
     { print $0 >> out }
  ' data

This will result in files for each inverter being created in the current (if you'll forgive the pun) directory.

Works as follows...

Filter for lines which define an inverter

$1 ~ /^#INV/

Remove leading #, define an output file, stop processing this line.

{ gsub(/^#/,"", $1) ; out = $1".out" ; next }
bxm
  • 5.2k
  • 1
  • 22
  • 26