Questions tagged [number-formatting]

Editing several numbers at once in a way that will keep their ordering and format (e.g. binary, octal, hex) unaltered.

Filter by
Sorted by
Tagged with
3 votes
2 answers
200 views

How can I add a specific range of numbers into to each line at a particular location?

For example, we have: 1 this is line. please go to file example.txt for more information. 2 this is line. please go to file demo.txt for more information. 3 this is line. please go to file ...
user avatar
  • 33
4 votes
2 answers
68 views

substitution of increasing numbers per row

Each row is: Or(a=a[0], b=b[0], out=out[0]); Or(a=a[0], b=b[0], out=out[0]); Or(a=a[0], b=b[0], out=out[0]); and I need: Or(a=a[0], b=b[0], out=out[0]); Or(a=a[1], b=b[1], out=out[1]); Or(a=a[2], b=b[...
user avatar
  • 161
1 vote
1 answer
156 views

How do I add a thousand seperator to a number?

Is it possible to add a thousands separator to a number or a selection of numbers? Before 42 4815162342 After 42 4.815.162.342 I have to perform this operation quite often, which is why I would ...
user avatar
  • 121
11 votes
4 answers
6k views

Increment numbers in text

I have a markdown file like this: Irish Bands: 1. U2 2. The Cranberries 3. The Dubliners English Bands: 1. Queen 2. Duran Duran 3. The Beatles American Bands: 1. Nirvana 2. Blondie 3. The Doors I ...
user avatar
  • 221
0 votes
1 answer
163 views

Increment the Nth number in the line

Ctrl-A is very useful for incrementing the first number in line, but what if the number you want to increment is not the first one? for an example, if want to make, Section. 1-1 Section. 1-2 ...
user avatar
0 votes
1 answer
80 views

Precision format in Vi

Is there a way to format numbers as per a precision format in Vi? I have a log file with a huge list of hexadecimal numbers, I would like to remove the '0x' prefix; then make the numbers show up ...
user avatar
8 votes
1 answer
20k views

Find and replace all numbers with 0?

Is there a command to find and replace all instances of a number in a file with 0 (including decimal numbers like 1.7)?
user avatar
6 votes
1 answer
379 views

Understand addition on numbers in Vim

I have a file with the following content: 001 Now if I start a macro (qq), yank this line (Y), paste it (p), increase the number by four (4Ctrlaa), end the macro (q), and execute this macro nine ...
user avatar
  • 895
8 votes
2 answers
821 views

How I force [count]<C-x> to leave leading zeros?

Context I use vifm as my file manager (that's off topic here, i know, but keep reading) which allows me to edit filenames inside a vim buffer. One issue i found myself annoyed at are numbered files ...
user avatar
  • 1,616