Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In my ongoing efforts to learn the command line, I have found the
'sort' command to sort files, in this case document text files. In the books I have, I find the option to sort by size, ie; smallest to largest or vice versa, but I can't see an option to sort by date created. By default files seem to sort alphabetically or by date modified. I would prefer to sort them by date created and then rename them numerically to keep them in that order. I only have a few files at present, so it's not an issue to rename them individually, once I have them sorted into the proper order. I realize I can do this from the GUI but I want to learn how to do it from the command line. All help appreciated.
Currently my files are text document, titled as,example; FileName.odt. I would like to sort them in order of date created and rename them with a common prefix, numerically as this example.
Cr(1)FileName.odt
Cr(2)FileName.odt
Cr(3)Filename.odt
Cr(4)FileName.odt
Naturally the (FileName) for each individual file would be unique to reflect the contents of the file. However having a common prefix as well as extension gives me a convenient way to move or copy them using wildcards.
Plus numbering them numerically will keep them sorted by folder, in the order I like them.
Renaming is not the issue, once they are sorted by date, the rename is relatively easy.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.