I'm not sure you get to claim a language is a scripting language and then ignore the boilerplate.
The equivalent python is 4 lines, just one more than the number of steps you're performing.
import sys
data = open(sys.argv[1]).readlines()
lines = sorted(data)
open(sys.argv[2], 'w').writelines(lines)
C++ is good at many things, but quickly creating readable scripts and live-coding with a REPL are not among them.