Post Reply 
HP-42S / Free42 Extension for Visual Studio Code
11-05-2018, 06:05 AM (This post was last modified: 11-05-2018 01:10 PM by Thomas Klemm.)
Post: #7
RE: HP-42S / Free42 Extension for Visual Studio Code
(11-05-2018 01:20 AM)tcab Wrote:  It would be nice, I think, to have a command to add line numbers back.

This command inserts line numbers to the files:
Code:
perl -i~ -ne 'printf "%02d $_", $.' <files ...>

The original files are renamed to contain a tilde (~) as suffix.
This can be changed of course. See perl -h:
Code:
  -i[extension]     edit <> files in place (makes backup if extension supplied)

If you use that command often you can make it a function and add it e.g. to your ~/.bash_profile:
Code:
function add_line_numbers ()
{
    perl -i~ -ne 'printf "%02d $_", $.' "$@"
}

Use %03d instead of %02d if you prefer 3-digit numbers.

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-05-2018 06:05 AM



User(s) browsing this thread: 1 Guest(s)