How to make line numbers fixed width in FFIND

May 29, 2008
571
4
Groton, CT
When using FFIND /L , line numbers are rendered as a [n] where n has no leading zeroes. Is there any way to cause the line numbers to be formatted with leading zeroes, like [01] or [001]?
 
It's not too hard with Perl:
Code:
ffind /L … | perl -p -e "s/\[(\d+)\]/sprintf(q([%%%%03i]),$1)/e;"
Here the %03i (plus escaping percents-%) formats to 3 digits with leading zeros.
 
Last edited:
May 29, 2008
571
4
Groton, CT
Thanks for the perl of wisdom. I'll try that.
...

I did try it. I downloaded and installed Strawberry Perl, and it worked after I modified the string of four consecutive percent signs down to only two of them.
 
Last edited:

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
This method doesn't depend on Perl.
Code:
do l in /p ffind /l /v /t"Take" readme.txt (echo.%@rereplace["\[(\d+)\](.+)",[%@format[03,\1]]\2,%l])

However, there appears to be a bug in @format. I imagine there's a way to do it using the built-in Lua interpreter too, or tpipe.
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
Here's one that uses the ridiculously complicated TPIPE
Code:
tpipe /input=readme.txt /line=1,1,0,0,-7.5d /grep=3,0,0,0,0,0,0,0,Take
 

samintz

Scott Mintz
May 20, 2008
1,511
18
Solon, OH, USA
It's kind of like programming in APL. You have no idea what the code does and it's usually easier just to rewrite it than trying to figure it out. It took me 20 minutes of futzing with the switches and various options before I figured it out.
 
May 20, 2008
11,520
102
Syracuse, NY, USA
Here's one that uses the ridiculously complicated TPIPE
Code:
tpipe /input=readme.txt /line=1,1,0,0,-7.5d /grep=3,0,0,0,0,0,0,0,Take
Nice one, Scott. It only took an hour to figure this out, but you can get the []s in there too.
Code:
g:\tc18> tpipe /input=readme.txt /line=1,1,0,0,-7.5d /grep=3,0,0,0,0,0,0,0,Take /replace=4,0,0,0,0,0,0,0,0,"^^(\d+?)",[$1]
[00001]  Take Command v18.0
[00012]  Greetings, and thanks for trying Take Command!
<snip>
 
Similar threads
Thread starter Title Forum Replies Date
C blank line in copy ... results Support 9
old coot LEAVE appears to affect command-line arguments Support 11
T VIEW only works from command line Support 14
vefatica `Back quotes` - command line vs. batch file Support 5
Phileosophos Is there any way to open the Take Command options dialog from the command line? Support 8
Phileosophos Command-line Editing Shortkeys That Fail Support 6
D How to use multi-line DO to loop through first level directory names Support 5
D Open Windows 10 Photos app from command line Support 11
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
Jesse Heines Strange Line Wrapping Behavior Support 14
fpefpe How to? command echo in title line/bar Support 2
vefatica Command line DO with no closing parenthesis? Support 9
R Long commands retrieved from command history have blank line when wrapped Support 20
M No line wraps if last line of the screen buffer is reached Support 5
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
R CMDebug, dark theme, current line Support 7
vefatica IDE - when breakpoint is on a blank line? Support 3
D Double Quote in TC Tool Bar Button Command line Support 3
Joe Caverly Expand all aliases on the command line Support 2
vefatica How do I do this with a multiple-line DO? Support 7
Jay Sage Cannot Postion Cursor in Command Line Using Mouse Support 7
vefatica Windows 10 and line wrapping selection? Support 6
vefatica IDE.EXE's command line? Support 19
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
D btm file command line augments comparing for string or math. Support 12
D Grabbing html text with @line Support 3
Chen Touboul Overtyping issue - i press the Insert key, help till press enter for new line in TCC Support 2
vefatica FFIND and multi-line regular expressions Support 4
P Escape key no longer clears command line in v24 Support 21
J File explorer handling from command line? Support 2
M Ctrl-C when using command line history does nothing Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
C Replace 1st argument on command line Support 4
vefatica Library functions and line continuations? Support 4
Joe Caverly Works in debugger, not from cmd line Support 1
P No linefeed on last line of console window Support 2
K Command Line Selection Not Working Support 12
J Error running Python at command line Support 9
Joe Caverly PSHELL Blank Line Display Support 2
rps How to? Alias/Command line use of *log on/off Support 2
x13 //directive ignored on TCC command-line Support 4
Joe Caverly Unicode, Codepage 437, and line characters Support 3
J How to? max. practical command line length? Support 3
mfarah WAD Odd behaviour with command-line arguments on TCMD. Support 7
T Regex engine doesn't recognize native DOS line endings Support 2
thorntonpg F1 on command line The webpage cannot be found Support 5
J Python: TCC command line parsing removes '=' equal sign characters Support 4
L Fixed console line length in Take Command 19? Support 3
C LOG entry for TCMD/TCC command line Support 15
fpefpe Documentation Can the title line of tcmd be set? Support 4

Similar threads