I have a number of directories like these :
./lab-results.n3668.2017-01-16 ./lab-results.n471.2017-02-24 ./tests.n287.2017-01-28 ./tests.n4501.2017-03-04
They contain unfortunately only one file but the name is the same.
./lab-results.n3668.2017-01-16/lab-results.pdf ./lab-results.n471.2017-02-24/lab-results.pdf ./tests.n287.2017-01-28/tests.pdf ./tests.n4501.2017-03-04/tests.pdf
I would like to move all these files after having renamed them like this :
./lab-results.n3668.pdf ./lab-results.n471.pdf ./tests.n287.pdf ./tests.n4501.pdf
So, it seems like some sh scripts I see there but I can't figure out how I can take a part of the directory's name characters to form the future name of the file.
lab-results.n9999 : max number available, will not change tests.n9999 : max number
I also may have others directories but always followed by a bunch of numbers within their names :
./xxxxxxx.n9999 ./yyyyyy.n9999 ./zzz.n9999
Any tips or help very much appreciated. I use bash 4.3.11(1) on a linux distrib.