Christian Schulz wrote: > ruby -pi*.bak -e 'gsub(/VAR_TYP/,"TYP").gsub(/VAR_FREQ/,"FREQ")' > file.dat You don't want the '*' after the 'i' flag (I suspect). Replace the '.' by a ';' between the two calls to gsub or replace the two calls to gsub by calls to gsub! (keeping your '.') and you should be ok. Note also that both your substitutions are doing the same thing (removing VAR_) so you can do it in one: ruby -pi.bak -e 'gsub /VAR_(TYP|FREQ)/, "\\1" ' file.dat (The double backslash here is required because of the use of double quotes. To avoid that, put the quotes the other way round: ruby -pi.bak -e "gsub /VAR_(TYP|FREQ)/, '\1' " file.dat -- Posted via http://www.ruby-forum.com/.