I want to move lines matching certain pattern from file1 to file2. Analogous to operation cut and paste from one file to another in windows
This might work for you (GNU sed):
sed -i -e '/bar/{w file2' -e 'd}' file1
An alternative:
sed -i -e '/bar/w file2' -e '//d' file1
To append to file2, write to a temporary file and use cat to append at the end of file in a bash script, or use:
sed -i -e '/bar/w tmpfile' -e '$e cat tmpfile >> file2 && rm tmpfile' -e '//d' file1
N.B. For the last solution, only one input file can be modified at a time.