I found this command on SO which is exactly what I wanted to know but I only see the console output. I need the command to re-write the file it’s working on (file.txt). This command takes every number (well, positive integer) in a file that is greater than 400 and add 13 to it.
perl -pe 's/\d+/$& > 400 ? $&+13 : $&/ge' file.txt
Add the option -i for in-place editing: