$ cat file
/tmp/foldera/folderb/folderc/file1
/tmp/folderc/folderd/foldere/file2
/tmp/folderf/folderg/folderh/file3
Need to move this files to
/tmp/foldera/
/tmp/folderc/
/tmp/folderf/
respectively using a loop or any easy handy way to do that.