Welcome!

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

SignUp Now!

Pipe into VIEW and search

Aug
1,904
68
I am using;
Code:
TCC  22.00.32 x64   Windows 7 [Version 6.1.7601]

As a test, here is test.txt;
Code:
The
quick
brown
fox
jumped
over
the
lazy
dog

I want to view the file, but start displaying the file at the position of a string match;
Code:
view test.txt /s:jumped

...which works as it should.

When piping into VIEW and doing a search;
Code:
type test.txt | view /s:jumped

...this does not work, that is, view is not launched, no result is returned.

If I pipe into LIST, it does work;
Code:
type test.txt | list /t"jumped"

How can I Pipe into VIEW and search?

Joe
 
Looks like command-line options work if you redirect into V.EXE, rather than going through the internal VIEW command ...?
 
Regardless of how I use VIEW;
Code:
echo %_?

returns 1

For example, this returns a 1;
Code:
view test.txt
even though it works as it should.

1 indicates a usage error, according to help. I do not have VIEW aliased.

Joe
 
Fixed in 22.0.33 (uploaded yesterday).

Just updated to
Code:
TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

Piping works, but VIEW still returns an errorlevel of 1, as noted in #3.

In TCC 18;
Code:
c:\users\jlc\utils>ver

TCC  18.00.32 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %_?
0

...in TCC 22;
Code:
c:\users\jlc\utils>ver

TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %_?
1

Joe
 
It's an external app.
Code:
c:\users\jlc\utils>ver

TCC  18.00.32 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %?
0

Code:
c:\users\jlc\utils>ver

TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %?
1

Code:
c:\users\jlc\utils>ver

TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %errorlevel
1

...still returns an errorlevel of 1 as an external app in TCC 22, but returns 0 in TCC 18.

Joe
 
It's an external app.

Code:
c:\users\jlc\utils>ver

TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>which view
view is an internal command

...which seems to disagree with that.

Joe
 
Code:
c:\users\jlc\utils>ver

TCC  22.00.33 x64   Windows 7 [Version 6.1.7601]

c:\users\jlc\utils>which view
view is an alias : "C:\Program Files\JPSoft\TCMD22\v.exe"

c:\users\jlc\utils>echo %@alias[view]
"C:\Program Files\JPSoft\TCMD22\v.exe"

c:\users\jlc\utils>view test.txt

c:\users\jlc\utils>echo %?
0

The above allows me to use VIEW both as a stand-alone, through a pipe, and returns the correct errorlevel.

Joe
 
Same here with build 33. "VIEW file" gives %? = 1 and "v.exe file" gives %? = 0.
 
I'm not sure what should happen here But, how should this work, given that TYPE is internal?
Code:
g:\tc22> type TCMD.INI | view

g:\tc22> echo %? %_?
1 1

g:\tc22> type TCMD.INI | V.exe

g:\tc22> echo %? %_?
0 0
 

Similar threads

Back
Top