On Sun, 18 Nov 2007 18:17:41 -0500, John Carter <john.carter / tait.co.nz> wrote: >On Mon, 19 Nov 2007, Ron Jeffries wrote: > >> I have no idea what it >> even means. If someone would care to translate it, I'd be interested >> and grateful. >> >> `#{ruby} -i.bak -pe 'sub(/^[0-9]+$/){$&.to_i * 5}' script_tmp` > >Back tick ` means run the following command and return whatever goes to stdout as a string. > >#{ruby} means interpolate into the command string the content of the > local variable ruby. My guess is the path to the ruby interpreter. > >-i.bak is a perlism to operator on the argument "script_tmp" backing > it up to "script_tmp.bak" prior to feeding it into stdin and stdout > to "script_tmp" > >-p is a perlism to iterate through every line of stdin placing each > line in default variable $_, execute the chunk of script specified by -e and > then printing the variable $_ to stdout. > >-e '' a perlism to execute the enclosed chunk of ruby. > >sub(//){} Operating on the default variable $_ > find the first occurrence of the regexp // and replace it with the result of the block {} > >/^[0-9]+$/ Match an integer filling the whole line. > >{$&.to_i * 5} Convert it to and integer and multiply by 5 Way more cryptic than I needed. Thanks. > >This would only be slow is script_tmp is massive. The backtick would >cause lots of swapping if the size of script_tmp was larger than >available free ram. Interesting. It surely isn't massive, these lines are preceded by these: tmp = open("script_tmp", "w") for i in 1..5 tmp.print i, "\n" end tmp.close Which make me think 5 lines. Wonder what's up with that. Might be interesting to zero in on ... Ron Jeffries www.XProgramming.com