Inline backreference?

#1
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>
 
#2
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,617
46
Albuquerque, NM
prospero.unm.edu
#4
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....
 
#5
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
 

samintz

Scott Mintz
May 20, 2008
1,294
11
Solon, OH, USA
#6
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
 

samintz

Scott Mintz
May 20, 2008
1,294
11
Solon, OH, USA
#7
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