I want to add the following perl command in my bash script please advice
how to change (reduce by one ) the last number that start with "+" character in file with perl ?
Example of original file ( before run the perl command )
more file
432423
53454
+535
343
45
+1000
example of requested output file ( after run the perl command )
more file
432423
53454
+535
343
45
+999
When I hear "do something on the LAST occurrance of ...", I reach for
tac
to reverse the lines, and do something on the FIRST occurrance.On Solaris, you may not have tac installed. You can implement it like this:
You can the following script: