I'm trying to use the "tr" command, and to use it's -d delete option. My purpose is to rearrange a list of files in order of date accessed.
I have a file orderedFile with the following contents:
Access: 2014-02-09 21:35:36.642598731 -0700 0) accessedfiles.cpp
Access: 2014-02-10 14:24:01.527811265 -0700 1) accessedfiles.sh
Access: 2014-02-10 14:24:03.563811320 -0700 2) onlyFilesListFile
Access: 2014-02-10 14:24:03.563811320 -0700 3) orderedFile
Access: 2014-02-10 14:23:37.623810616 -0700 4) properlyOrdered
Access: 2014-02-10 14:23:37.543810614 -0700 5) smallestToLargest
Access: 2014-02-09 21:35:36.642598731 -0700 6) strace.txt
Access: 2014-02-09 21:35:36.638598730 -0700 7) sum.cpp
Access: 2014-02-10 13:24:54.415715076 -0700 8) test
Access: 2014-02-09 21:35:36.638598730 -0700 9) testFile
I then use the command tr -d 'Access: ' to cut that Access part off of each line (this is done with a bash script on every line) and I get the following output in a new file properlyOrdered:
2014-02-09213536.642598731-07000)adfil.pp
2014-02-10142401.527811265-07001)adfil.h
2014-02-10142403.563811320-07002)onlyFilLitFil
2014-02-10142403.563811320-07003)ordrdFil
2014-02-10142337.623810616-07004)proprlyOrdrd
2014-02-10142337.543810614-07005)malltToLargt
2014-02-09213536.642598731-07006)tra.txt
2014-02-09213536.638598730-07007)um.pp
2014-02-10132454.415715076-07008)tt
2014-02-09213536.638598730-07009)ttFil
So I now have the date right up front and east to use grep on, but the file names have gone all funky and compressed. Any idea why? They will be harder to match to their full names now.