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