Welcome!

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

SignUp Now!

TTC Equivalent to Perl `One-Liner'

Jun
26
0
The Perl one-liner below works as expected under the TCC (v10) command shell. That is, it pretty prints the path. Is there a solution that doesn't rely on external tools, i.e., is there an equivalent TCC one-liner?
path |! perl -pe "s/(;|=)/\n/g"

This is more of a curiosity question.

thanks
rick
 
hensh wrote:
| The Perl one-liner below works as expected under the TCC (v10)
| command shell. That is, it pretty prints the path. Is there a
| solution that doesn't rely on external tools, i.e., is there an
| equivalent TCC one-liner?path |! perl -pe "s/(;|=)/\n/g"

If you gave an example of what the perl command does (I don't know anything
about perl) rather than saying "it pretty prints the path" (an extremely
ambiguous statement) we might be able to help. Trying to interpret the perl
command as if it were a vi "substitute" command, it looks as if it replaced
every occurrenceof the characters ":", "|" and "=" with newlines, i.e., it
splits the path into one line per element. If that is correct, try the
command below:

@for /l %w in (0,1,%@dec[%@words[";|=",%path]]) echo %@word[";|=",%w,%path]
--
HTH, Steve
 
hensh wrote:
| The Perl one-liner below works as expected under the TCC (v10)
| command shell. That is, it pretty prints the path. Is there a
| solution that doesn't rely on external tools, i.e., is there an
| equivalent TCC one-liner?path |! perl -pe "s/(;|=)/\n/g"

If you gave an example of what the perl command does (I don't know anything
about perl) rather than saying "it pretty prints the path" (an extremely
ambiguous statement) we might be able to help. Trying to interpret the perl
command as if it were a vi "substitute" command, it looks as if it replaced
every occurrenceof the characters ":", "|" and "=" with newlines, i.e., it
splits the path into one line per element. If that is correct, try the
command below:

@for /l %w in (0,1,%@dec[%@words[";|=",%path]]) echo %@word[";|=",%w,%path]
--
HTH, Steve

Sorry.

The output should be:
c:\path1
c:\path2
...

which is exactly what your ``one-liner'' does. Thanks!
 
While this doesn't catch all three characters, it is quite simple. Since
the semicolon is the actual path separater (I don't know why you're
including the other chars) this works quite well.

It means replace all occurances of semicolon with a newline in the path
variable and echo the result.

echo %@replace[;,^n,%path]

-Scott


Steve F$BaC(Bi$BaO(B <> wrote on 06/08/2009 08:06:22 AM:


> hensh wrote:
> | The Perl one-liner below works as expected under the TCC (v10)
> | command shell. That is, it pretty prints the path. Is there a
> | solution that doesn't rely on external tools, i.e., is there an
> | equivalent TCC one-liner?path |! perl -pe "s/(;|=)/\n/g"
>
> If you gave an example of what the perl command does (I don't know
anything

> about perl) rather than saying "it pretty prints the path" (an extremely


> ambiguous statement) we might be able to help. Trying to interpret the
perl

> command as if it were a vi "substitute" command, it looks as if it
replaced

> every occurrenceof the characters ":", "|" and "=" with newlines, i.e.,
it

> splits the path into one line per element. If that is correct, try the
> command below:
>
> @for /l %w in (0,1,%@dec[%@words[";|=",%path]]) echo
%@word[";|=",%w,%path]

> --
> HTH, Steve
>
>
>
>
 

Similar threads

Replies
6
Views
2K
Back
Top