I keep a diary file of tech notes. Each entry is timestamped like so:
# Monday 02012-05-07 at 01:45:20 PM
This is a sample note
Lorem ipsum dolor sit amet,
You set the "batch-file" tag in your question, so I wrote a Batch file .bat solution. Here it is:
@echo off
setlocal EnableDelayedExpansion
set daysOfWeek=/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday/
for /F "delims=" %%a in (input.txt) do (
if not defined timeStamp (
set timeStamp=%%a
) else if not defined fileName (
set fileName=%%a
(
echo !timeStamp!
echo/
echo !fileName!
echo/
) > "!fileName!.txt"
) else (
for /F "tokens=2" %%b in ("%%a") do if "!daysOfWeek:/%%b/=!" equ "%daysOfWeek%" (
echo %%a>> "!fileName!.txt"
) else (
set timeStamp=%%a
set "fileName="
)
)
)
For example:
C:\Users\Antonio\Documents\test
>dir /B
input.txt
test.bat
C:\Users\Antonio\Documents\test
>test
C:\Users\Antonio\Documents\test
>dir /B
Here is another one.txt
input.txt
test.bat
This is a sample note.txt
C:\Users\Antonio\Documents\test
>type "Here is another one.txt"
# Wednesday 02012-06-06 at 03:44:11 PM
Here is another one
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
C:\Users\Antonio\Documents\test
>type "This is a sample note.txt"
# Monday 02012-05-07 at 01:45:20 PM
This is a sample note
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.