I'm a newbie so please help:
I keep a journal on my iPhone using Scratch that outputs all notes I make to a separate .txt file stored in Dropbox.
I have this synced with my Ubuntu 14.04 system, so in my Files I have a folder with all the text files stored in it here:
/home/stuart/Dropbox/Scratch
I want to run a command that concatenates all these files into one file, with the following provisos:
- Ordered by date created (earliest file first)
- Print the date of the file on a separate line before the contents of the file
- Include a blank line followed by some kind of separator line after each file
So the output file has entries that look something like this:
12-01-2014 11:01 AM:
A coffee shop in Israel. The sign outside reads:
"Coffee" - 9 shekel
"Coffee please" - 8 shekel
"Good morning, could I have a coffee please?" - 7 shekel--
25-01-2014 11:01 AM:
You cannot outperform your ego - ole Gunnar solskjaer--
And so on. I used to use a different app that did this kind of auto append but I have no idea how to replicate it.
I've looked over a lot of the help files on here but I've not found any that can help with the output I have in mind.
Any help greatly appreciated!
MORE INFO
I tried creating the script suggested below and followed the steps. However I get this response:
stuart@StudioClough:/home$ chmod +x $HOME/my_concat
stuart@StudioClough:/home$ ./my_concat /home/stuart/Dropbox/Scratch > new_concatenated_file
bash: new_concatenated_file: Permission denied
Do I have to somehow run it as sudo?
/home
directory, which is different from$HOME
. Do your work in$HOME
:cd $HOME; chmod +x $HOME/my_concat; ./my_concat /home/stuart/Dropbox/Scratch > new_concatenated_file
. – muru Sep 29 '14 at 18:13