You are not logged in.

#1 2014-04-30 16:06:07

publicus
Member
Registered: 2014-01-01
Posts: 129

[SOLVED] Unable to capture output with newline breaks

Hello,

I'm running a utility that works over a serial connection and then dumps data to the screen:

...
  00000000:  02 FE 01 6D  00 00 00 00  09 FE 02 17  00 40 3D 80
  00000010:  00 00 20 00  DA 00 00 00  00 00 00 00  00 00 00 00
  00000020:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000030:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000040:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000050:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000060:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000070:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000080:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  00000090:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  000000A0:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  000000B0:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  000000C0:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
  000000D0:  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
...

However, when I do the following...

RESULTS=`/usr/bin/java -Dcfg=config.txt -Dconsole -jar ~/code/copy_utility.jar`
echo $RESULTS >| $CURRENT_DIRECTORY/temp.txt

And then check out temp.txt, all of that information is in one giant long line.  How can I include newline characters in there?

Last edited by publicus (2014-04-30 18:13:04)

Offline

#2 2014-04-30 16:07:30

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] Unable to capture output with newline breaks

Try echo "$RESULTS"


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2014-04-30 16:08:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,332
Website

Re: [SOLVED] Unable to capture output with newline breaks

quote $RESULTS in the second line


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2014-04-30 18:12:19

publicus
Member
Registered: 2014-01-01
Posts: 129

Re: [SOLVED] Unable to capture output with newline breaks

Hello.  Thanks to both of you.  The quotes did the trick.

Offline

Board footer

Powered by FluxBB