Welcome!

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

SignUp Now!

Inline backreference?

Jun
223
0
Is there a possibility to backreference the command line tokens in TCC?

Sample:

grep -g <file>test.txt -o [backref#3].new

which would expand to:

grep -g test.txt <file> -o test.txt<file>.new</file></file>
</file>
 
From: nickles
| Is there a possibility to backreference the command line tokens in
| TCC?
|
| Sample:
|
| grep -g test.txt -o [backref#3].new
|
| which would expand to:
|
| grep -g test.txt -o test.txt.new

It is easy to do in aliases and batch files - your example would use %2. No method I am aware of to do it in the command line, i.e., interactively. When I need something like this the token to be repeated is usu. a file or directory name, so I just use tab-expansion. My most common use is when I want to use the RENAME command to move a file or a directory to a new location.
--
Steve
 
Thanks for the answer Steve.

I'd like to do it from the command line however, w/o the need to write a BTM file for all such occasions.

nickles
 
Is there a possibility to backreference the command line tokens in TCC?

Sample:

grep -g <file>test.txt -o [backref#3].new

which would expand to:

grep -g test.txt <file> -o test.txt<file>.new</file></file>
</file>

I thought that was what the F12 key was for. But now that I try it, it doesn't seem to work the way I thought it did....
 
From: nickles
| I'd like to do it from the command line however, w/o the need to
| write a BTM file for all such occasions.

If you have the same command structure with only a single parameter changing for each invocation, you could write an alias. E.g. for your original example:

alias grepg=`grep -g %1 -o %1.new`

which you can use thus:

grepg text.txt

I know this is much less than what you'd like, but it is all I can think of off-hand.
--
HTH, STeve
 
Well, if you know you are going to need a second reference to a file, then the combination of TAB and F12 will help.

HTML:

basically you type: grep -g text.txt<TAB><F12><Ctrl+Left>-o <END>.new


While slightly cumbersome, it's still less typing than having to type the name again.

But if that command is something you do often, then making an alias will ease your life. Plus you could always implement the alias, then type the command like Steve suggested, then press CTRL+X (or Ctrl+F I can never remember) to expand the alias and edit it.
-Scott-----Steve Fabian <> wrote: -----


From: nickles| I'd like to do it from the command line however, w/o the need to| write a BTM file for all such occasions. If you have the same command structure with only a single parameter changing for each invocation, you could write an alias. E.g. for your original example:alias grepg=`grep -g %1 -o %1.new`which you can use thus:grepg text.txtI know this is much less than what you'd like, but it is all I can think of off-hand.-- HTH, STeve
 
Well, that sure got mangled in translation. The text originally contained
angle brackets. Looks like it's okay on the web page though.

I'll try square brackets instead of angle brackets and see if it comes
through.

Code:
basically you type: grep -g text.txt[TAB][F12][Ctrl+Left]-o [END].new

-Scott



Well, if you know you are going to need a second reference to a file, then
the combination of TAB and F12 will help.

HTML Code:
basically you type: grep -g text.txt-o .new
While slightly cumbersome, it's still less typing than having to type the
name again.

But if that command is something you do often, then making an alias will
ease your life. Plus you could always implement the alias, then type the
command like Steve suggested, then press CTRL+X (or Ctrl+F I can never
remember) to expand the alias and edit it.
-Scott-----Steve Fabian <> wrote: -----


From: nickles| I'd like to do it from the command line however, w/o the
need to| write a BTM file for all such occasions. If you have the same
command structure with only a single parameter changing for each
invocation, you could write an alias. E.g. for your original example:alias
grepg=`grep -g %1 -o %1.new`which you can use thus:grepg text.txtI know
this is much less than what you'd like, but it is all I can think of
off-hand.-- HTH, STeve
 
Back
Top