in reply to Swaping a record in a File

Open two new files (A and B), then go through the original file line by line. If a line in the original file matches the pattern, append to file A. If not, append to file B. Finally, cat files A and B together.