From: Robert Klemme Date: 2011-07-20T18:20:28+09:00 Subject: Re: copy range of lines to another file based on regex match Neubyr Neubyr wrote in post #1011813: > I am writing a script to search for a particular string in a file and > then copy all lines starting from matching-line to another file. > Following should make it clear again: > * search for first occurrence of a particular string in a file > * find it's line number > * copy certain text in all lines or entire line, starting from above > line number to EOF to another file $ sed -n -e '/rx/,$ {s/foo/bar/g; p}' a_file :-) Kind regards robert -- Posted via http://www.ruby-forum.com/.