I have a file which looks like below.
1 1 0 # 1
6 1 0 # 2
8 1 0 # 3
10 1 0 # 4
12 1 0 # 6
How can I add .0 to all numbers, except the numbers behind the #. I think this should not be too difficult to do with a regular expression, but my regex knowledge is too rusty..
If your numbers after the
#don’t have spaces after them, you can use:The use of
()creates groups which you can refer to as\Din the replacement text, whereDis the position of the group within the search string. This will give you:If they do have spaces after them (which yours seem to have), you’ll get:
in which case you can then do:
to fix it up.