Read and respond to this message at: 
https://sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/3896831
By: bkmunger

I am trying to use gawk to extract a set of lines from a text file.  The limes
start with a certain identifier but are not always at the same line numbers
in the file.  An example is below.  I want to find the identifier "REPORT- PS-E"
and then extract the set of 5 lines starting with the 13th occurance of the
string "KWH".  I have to do this frequently so I am trying to set up a batch
file to do this.  I have used gawk before but my code writing skills are very
rusty.  Can anyone help?

Thanks, Bryce

---- start of identifier -------
REPORT- PS-E Energy End-Use Summary for all Electric Meters                
WEATHER FILE- PORTLAND INTERNAT OR
--------------------------------------------------------------------------------
-------------------------------------------------

                         TASK     MISC    SPACE    SPACE     HEAT    PUMPS 
VENT    REFRIG  HT PUMP   DOMEST    EXT
               LIGHTS   LIGHTS   EQUIP   HEATING  COOLING   REJECT   & AUX 
FANS   DISPLAY  SUPPLEM  HOT WTR   USAGE    TOTAL
              -------  -------  -------  -------  -------  -------  -------
-------  -------  -------  -------  -------  --------

JAN
KWH            75964.       0.   15908.   41390.    2976.       0.     566.
42293.       0.    2162.       0.       0.   181257.
MAX KW        166.020    0.000   61.777  212.826   39.967    0.000    1.600
89.701    0.000   21.767    0.000    0.000   499.692
DAY/HR           1/ 8     0/ 0     4/12     4/ 6    20/16     0/ 0     4/21
1/ 8     0/ 0     1/ 8     0/ 0     0/ 0      4/ 6
PEAK ENDUSE   166.020    0.000   11.812  212.826    0.000    0.000    0.077
89.701    0.000   19.255    0.000    0.000
PEAK PCT         33.2      0.0      2.4     42.6      0.0      0.0      0.0
18.0      0.0      3.9      0.0      0.0
-------- skip lines for post length -------
-------- want to extract --------
KWH           906775.       0.  195025.  163578.  232611.       0.    3826.
465954.       0.    6672.       0.       0.  1974442.
MAX KW        166.020    0.000   61.777  212.826  335.375    0.000    1.600
89.701    0.000   21.767    0.000    0.000   629.360
MON/DY           1/ 1     0/ 0     1/ 4     1/ 4     7/21     0/ 0     1/ 4
1/ 1     0/ 0     1/ 1     0/ 0     0/ 0      7/21
PEAK ENDUSE   166.020    0.000   38.264    0.000  335.375    0.000    0.000
89.701    0.000    0.000    0.000    0.000
PEAK PCT         26.4      0.0      6.1      0.0     53.3      0.0      0.0
14.3      0.0      0.0      0.0      0.0
---------- end of extract -----------

_____________________________________________________________________________________
You are receiving this email because you elected to monitor this topic or 
entire forum.
To stop monitoring this topic visit: 
https://sourceforge.net/projects/gnuwin32/forums/forum/74807/topic/3896831/unmonitor
To stop monitoring this forum visit: 
https://sourceforge.net/projects/gnuwin32/forums/forum/74807/unmonitor

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
GnuWin32-Users mailing list
GnuWin32-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuwin32-users

Reply via email to