Scrolling output to single, non-scrolling line

Jun 1, 2008
30
0
I've got a command-line app which spits out a long, quickly scrolling output as it works. The output consists of similar, repeated lines in which some numbers are updated continuously as the app works. Is there a way to pipe this output through something (via stdin or some such), so that instead of the quickly scrolling output, I get a single, non-scrolling line with constantly updated numbers? I've seen command-line apps whose real-time output is a single, but constantly changing line.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: element
To: ESFabian@zenge.org
Sent: Tuesday, 2011. February 8. 14:28
Subject: [Support-t-2595] Scrolling output to single, non-scrolling line

| I've got a command-line app which spits out a long, quickly scrolling
| output as it works. The output consists of similar, repeated lines in
| which some numbers are updated continuously as the app works. Is
| there a way to pipe this output through something (via stdin or some
| such), so that instead of the quickly scrolling output, I get a
| single, non-scrolling line with constantly updated numbers? I've seen
| command-line apps whose real-time output is a single, but constantly
| changing line.

Assuming that your command line application is a TCC batch file, replace the ECHO statement that generates the varying output with:

echos %=rxxxx

where "xxxx" is the data displayed by the ECHO command it replaces. The ECHOS command does not append a "new line" when completed (unlike ECHO), and the %=r sequence starts each line with a "carriage return", i.e., on the left margin.

I use this technique often.
--
HTH, Steve
 
Jun 1, 2008
30
0
Assuming that your command line application is a TCC batch file, replace the ECHO statement that generates the varying output with:

Thanks, that's a good trick to know. But in this case, I don't have access to the app's code. I just get the output. Is there a pipe trick that would do the same op on stdin? That is, read stdin via a pipe, for each line add the '\r' at the beginning, drop the '\n', and print that out?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: element
| Quote:
| Originally Posted by Steve Fabian
|| Assuming that your command line application is a TCC batch file,
|| replace the ECHO statement that generates the varying output with:
|
| Thanks, that's a good trick to know. But in this case, I don't have
| access to the app's code. I just get the output. Is there a pipe
| trick that would do the same op on stdin? That is, read stdin via a
| pipe, for each line add the '\r' at the beginning, drop the '\n', and
| print that out?

Untested approach:

application | for %x in (@con:) echos %=r%x

Try it - it may do what you desire.
--
HTH, Steve
 
May 20, 2008
11,400
99
Syracuse, NY, USA
On Tue, 08 Feb 2011 21:09:11 -0500, Steve Fabian <> wrote:

|Untested approach:
|
|application | for %x in (@con:) echos %=r%x
|
|Try it - it may do what you desire.

That will overwrite each line but not erase the tail (which might be necessary).
With ANSI turned on, you could erase the tail with ^e[K.

Test it with ping.exe; it works nicely. You see one line with the "time=..."
continually updating.

Code:
v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
Reply from 207.7.82.31: bytes=32 time=60ms TTL=53[K
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: vefatica
To: ESFabian@zenge.org
Sent: Tuesday, 2011. February 8. 22:47
Subject: RE: [Support-t-2595] Scrolling output to single, non-scrolling
line

| On Tue, 08 Feb 2011 21:09:11 -0500, Steve Fabian <> wrote:
|
|| Untested approach:
||
|| application | for %x in (@con echos %=r%x

Due to "smilies" the colon : right-parenthesis ) sequence after "con" was mangled...

||
|| Try it - it may do what you desire.
|
| That will overwrite each line but not erase the tail (which might be
| necessary).
| With ANSI turned on, you could erase the tail with ^e[K.

Good point; in my own use erasing is not necessary, overwrite is always perfect.

|
| Test it with ping.exe; it works nicely. You see one line with the
| "time=..."
| continually updating.
|
|
| Code:
| v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
| Reply from 207.7.82.31: bytes=32 time=60ms TTL=53[K

Strange aftereffect: the [K shows up in the display, possibly because of the need to terminate PING with a ctrl-C or ctrl-break.
--
Steve
 
May 20, 2008
11,400
99
Syracuse, NY, USA
On Tue, 08 Feb 2011 23:11:09 -0500, Steve Fabian <> wrote:

|| Code:
|| v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
|| Reply from 207.7.82.31: bytes=32 time=60ms TTL=53[K
|
|Strange aftereffect: the [K shows up in the display, possibly because of the need to terminate PING with a ctrl-C or ctrl-break.

No, that was me, in editing my post. I pasted the command first, then the
output line (in the wrong place), then noticed "^e[K" missing from the command
and added it again.
 
Jun 1, 2008
30
0
Code:
v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
How would I implement the above as an alias? If I copy the line literally, I get the multiline ping.
Code:
ping2=ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
I tried replacing the "^" with "%=", but it's still multiline.
Code:
ping2=ping -t jpsoft.com | for %x in (@con:) echos %=r%x%=e[K
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: element
| Quote:
| Originally Posted by vefatica
| Code:
| v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
|
| How would I implement the above as an alias? If I copy the line
| literally, I get the multiline ping.
|
| Code:
| ping2=ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
| I tried replacing the "^" with "%=", but it's still multiline.
|
| Code:
| ping2=ping -t jpsoft.com | for %x in (@con:) echos %=r%x%=e[K

There indeed appears to be a problem with the X3.64 command K - it erases to EOL, but adds a new line sequence. If you don't mind clearing the screen when you begin, you can use this sequence:

ping2=ping -t jpsoft.com | for %x in (@con:) echos %=e[J%x

which clears the screen before each line of output, every line starts in the top left corner.
--
Steve
 
May 20, 2008
11,400
99
Syracuse, NY, USA
On Wed, 09 Feb 2011 08:11:23 -0500, Steve Fabian <> wrote:

| There indeed appears to be a problem with the X3.64 command K - it erases to EOL, but adds a new line sequence. If you don't mind clearing the screen when you begin, you can use this sequence:

It doesn't do that outside an alias. My original example (with ping) works at
the command line but not in an alias. I don't know why. With the escape
sequence in it, it's hard to even see the alias.

Aha! Even the alias works OK as long as you're not on the last line of the
console window. In that case, apparently, the ^e[K causes a scroll (possibly a
bug in its implementation). I used

Code:
v:\> alias pi `ping -t jpsoft.com | for %x in (@con:) echos
^r%x^e[K`
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- Original Message ----
From: vefatica
| Aha! Even the alias works OK as long as you're not on the last line
| of the
| console window. In that case, apparently, the ^e[K causes a scroll
| (possibly a
| bug in its implementation). I used
|
|
| Code:
| v:\> alias pi `ping -t jpsoft.com | for %x in (@con:) echos
| ^r%x^e[K`

Confirmed. <esc>[K incorrectly causes scrolling when on the last line of the screen, but not otherwise.
--
Steve
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
You could also append spaces to the end.
The other issue you'll run into is special symbols like the redirection
symbols in the output. You'll need to use setdos /x or quote the
output.

If you know your output line length
varies by 10 characters, you can append 10 spaces at the end.

ping -t jpsoft.com | for %x in (@con) echos ^r"%x"`
`

Note that the colon is not necessary after @CON and
the spaces are in back quotes.

-Scott


Steve Fabian <> wrote on
02/09/2011 08:11:21 AM:


> Steve Fabian <>
> 02/09/2011 08:11 AM
>
> Please respond to
>
>
> To
>
> Samintz@ra.rockwell.com
>
> cc
>
> Subject
>
> RE: [Support-t-2595] Re: Scrolling output to single, non-scrolling
line

>
> ---- Original Message ----
> From: element
> | Quote:
> | Originally Posted by vefatica
> | Code:
> | v:\> ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
> |
> | How would I implement the above as an alias? If I copy the line
> | literally, I get the multiline ping.
> |
> | Code:
> | ping2=ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
> | I tried replacing the "^" with "%=", but it's
still multiline.

> |
> | Code:
> | ping2=ping -t jpsoft.com | for %x in (@con:) echos %=r%x%=e[K
>
> There indeed appears to be a problem with the X3.64
command K -

> it erases to EOL, but adds a new line sequence. If you don't mind


> clearing the screen when you begin, you can use this sequence:
>
> ping2=ping -t jpsoft.com | for %x in (@con:) echos %=e[J%x
>
> which clears the screen before each line of output, every line
> starts in the top left corner.
> --
> Steve
>
>
>
>
 
Jun 1, 2008
30
0
Aha! Even the alias works OK as long as you're not on the last line of the console window. In that case, apparently, the ^e[K causes a scroll (possibly a bug in its implementation)

Thanks. I read the alias from an alias.lst file. So to prep the console, I first add one line, than move the cursor up.
Code:
ping2=echo. & echos ^e[1A & ping -t jpsoft.com | for %x in (@con:) echos ^r%x^e[K
 
Similar threads
Thread starter Title Forum Replies Date
MickeyF slightly off horizonal scrolling in TCC Support 25
vefatica Undesired scrolling in Windows 10 enhanced console. Support 2
A How to? TCMD Configuration Dialog: 'Smooth Scrolling' Option missing? Support 1
vefatica WAD Vertical scrolling screwy in TC Support 1
Stefano Piccardi How to? keep console from scrolling Support 6
mfarah Mouse wheel scrolling in TCC. What should we expect? Support 10
S Smooth scrolling in a TCC window Support 9
A How to? TEE - duplicate output to STDERR Support 3
FreezerBurnt ANSI Prompt messes up list output. Support 39
Ó Recent git output not shown on TCC Support 1
Peter Murschall TEE cannot handle Unicode output Support 2
C TEE command appending null characters to output Support 6
Jesse Heines webform output different in ver. 26 than ver. 25 Support 2
vefatica Piping the output of a DO loop. Support 4
vefatica TCMD output invisible on Win10 Support 22
B How can TCC make an output as a part of command string Support 2
Enigma Take Command 23 duplicates output Support 0
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
S Output from debugger Support 4
M TCC incorrect dir output since Windows 1803 Support 6
A WAD Output redirection to IF block fails with "unbalanced brackets" Support 7
P Scrollable colored output Support 3
scottb How to? ipconfig output in current window Support 4
David McClelland TEE command puts it's output file in c:\ Support 4
vefatica How to? TPIPE ... see output right away? Support 4
T Fixed Unnecessary debug output Support 3
JohnQSmith Weird DIR output (missing lines) Support 1
J WAD Output redirection in tcexit looses data Support 31
vefatica Console output slower that before Support 8
Mordachai How to capture all console output from a TCMD session? Support 4
C Output continues after Ctrl-Break Support 8
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
I perl output is not visible Support 4
I v16 - cls corrupts output stream Support 7
D Fixed Minor problem: output not alligned in the tree command Support 1
vefatica WAD IDE, output window to foreground Support 3
R WAD Strange output from "memory" command Support 1
A How to? Set up a log file for all command output Support 3
A How to? Use TEE with .NET output Support 6
T How to? Logging Output from External Programs Support 4
Frank output of @ipaddress/@ipname Support 1
dcantor Unidentifiable output Support 16
Stefano Piccardi forum software writes debugging output Support 5
Stefano Piccardi TCC 13 vs. TCC 14 different FFIND /E"d$" output Support 1
H TPIPE: /FILTER and /OUTPUT unexpected incompatibility Support 6
Stefano Piccardi issue: redirecting GOSUB output Support 11
A How to? Pass output from ffind to another command in a BTM file Support 5
J Can you redirect output to printer device with echo? Support 1
A How to? How to enable UTF-8 output in tcmd.ini Support 9
W Ascii character output Support 12

Similar threads