A cp would output an error cp: invalid option -- 'w'
In reality, you got unpredictable result,only luck and coincidence helped no damage is done.
You can achieve desired output using awk , cut or similar tools.
But that code can break on filenames with spaces, and possibly others.
If you are sure those will not exist...
So, for travesting filesystem and doing operations the safest tools would be find and xargs with print0 and option -0 .