Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

Other programming languages • Re: Scripting help needed - extract a part of long string into a variable

$
0
0
Thanks! (yet again...) :)
I'm not so versed in bash, but I need to use it a lot.
And when I run into a problem that noone has a solution for on google I ask here, and the problem gets solved!
Amazingly good community and participants!
Thanks again!

Final iteration:

Code:

#!/bin/bashatq | while read id day dom month time year detailsdo  date "+%Y-%m-%d %H:%M  $details  $id" -d "$day $dom $month $time $year"done | sort
and result

Code:

 $ atshow2024-02-11 12:00  = bosse  14162024-02-11 14:00  a bosse  14172024-02-11 16:00  a bosse  14182024-02-11 16:02  a bosse  14192024-02-11 18:00  a bosse  14212024-02-11 18:02  a bosse  14202024-02-11 19:00  a bosse  14222024-02-11 22:00  a bosse  14232024-02-11 23:00  a bosse  14242024-02-12 00:00  a bosse  14252024-02-12 01:00  a bosse  14262024-02-12 03:00  a bosse  14272024-02-12 04:45  a bosse  14152024-02-12 05:00  a bosse  1428
at does not have seconds resolution so I removed these...

Statistics: Posted by Bosse_B — Sun Feb 11, 2024 10:47 am



Viewing all articles
Browse latest Browse all 3552

Trending Articles