Re: [foxboro] Parsing dedit output

  • From: Duc M Do <duc@xxxxxxxxxx>
  • To: foxboro@xxxxxxxxxxxxx
  • Date: Wed, 12 Apr 2017 13:40:29 -0400

Ignacio,
Greg is right. A simple awk scriptlet can do what you need. The â€‹key is how
to tell awk programmatically to concatenate the 2 lines where you want them
concatenated, and not do it where you don't.

Looking at a sample d_edit output, I can see the lines you want to join are
in the Operator Actions section, and all have the "Execute" action in them.
So then it's a simple matter of searching for lines that have "Execute",
looking at the next line to see if it starts with a bunch of spaces (4 to
be exact), if so, join the two lines.

Here's your script:

========= begin of script =========
#!/bin/sh

# this file is concat.sh
# Usage: concat.sh <dispname>
# the output is saved in <dispname>.cmd

DEDIT=/usr/fox/wp/bin/tools/d_edit
DISP=$1

$DEDIT -l $DISP > ${DISP}.output
awk '/Execute/ {line1 = $0
                getline
                if ($0 ~ /^    /) {print line1, $0}
               }' ${DISP}.output > ${DISP}.cmd
rm ${DISP}.output
========= end of script =========

I leave it as an exercise for you to remove the extra spaces at the end of
the first line.

Good luck!

Duc


On Wed, Apr 12, 2017 at 10:26 AM, Greg Hurwitt <gregory.hurwitt@xxxxxxxx>
wrote:

A simple awk script will do exactly what you want.  Can probably be done
in one or two lines of awk code.  Unfortunately, it's been too long since
I've worked with awk for me to give you further guidance.  I imagine you
can still find awk references on line.
Greg Hurwitt
BASF Corporation, Houston, TX 77079, USA

-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of QUEIROLO, IGNACIO ESTEBAN
Sent: Thursday, April 06, 2017 9:52 AM
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] Parsing dedit output

Unix Folks,
I have the following line from an output of the dedit command:

170 RECT  68,5%   Execute             0
    ov_conn -cb MOLEX:67TC068. -file /opt/cie/gov/ov_pid 1 -sticky

And I need this:

170 RECT  68,5%   Execute             0    ov_conn -cb MOLEX:67TC068.
-file /opt/cie/gov/ov_pid 1 -sticky

How can I append or combine two lines where dedit splited them into two?

Thanks





 
 
_________________________________________________________________________
This mailing list is neither sponsored nor endorsed by Schneider Electric
(formerly The Foxboro Company).  Use the info you obtain here at your own
risks.  See the disclaimer at www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:               //www.freelists.org/list/foxboro
to subscribe:           mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:        mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: