Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Scrolling output to single, non-scrolling line

Jun
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.
 
---- Original Message ----
From: element
To: [email protected]
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
 
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?
 
---- 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
 
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
 
---- Original Message ----
From: vefatica
To: [email protected]
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
 
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.
 
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
 
---- 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
 
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`
 
---- 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
 
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
>
> [email protected]
>
> 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
>
>
>
>
 
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

Back
Top