Replace Script w/ Date Conversion

2019-01-04 Thread 'Holger Bartel' via BBEdit Talk
Hi, 

I have a bunch of .yaml files in which I would like to replace/add one value 
with a timestamp, which needs to be created from two other fields/values. I 
think this needs the help of a filter/shell script and I’d love a pointer in 
the direction of how to achieve this.

The file looks like the below and there can be other key/value pairs in between 
or even the order could vary, but that’s more unlikely: 



Date: 2019-01-04



Time: 14:00



Eventtimestamp: 1546596000

In most files the timestamp is empty (some might not be) and needs to be 
created from the `Date` and `Time` values. 

Thanks in advance for any help and a happy new year, 
Holger

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Replace Script w/ Date Conversion

2019-01-04 Thread Christopher Stone
On 01/04/2019, at 09:56, 'Holger Bartel' via BBEdit Talk 
mailto:bbedit@googlegroups.com>> wrote:
> I have a bunch of .yaml files in which I would like to replace/add one value 
> with a timestamp, which needs to be created from two other fields/values. I 
> think this needs the help of a filter/shell script and I’d love a pointer in 
> the direction of how to achieve this.


Hey Holger,

It would be useful to have a couple of actual example files.

You need to explain how you plan to access the files – what your actual 
workflow looks like.

It appears that you're transforming from normal date/time to epoch time - yes?

That transformation will definitely require some scripting.

You say you need to replace/add one value – what does that mean?

Are you needing to remove both the date and time stamps and replace them with 
the “Eventtimestamp”?

Or are you needing to simply add the “Eventtimestamp” after the other stamps?

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: Replace Script w/ Date Conversion

2019-01-06 Thread 'Holger Bartel' via BBEdit Talk
Hi Chris, Attached you can find a sample file. The only thing different in other files is that the order of the keys might differ. Let’s also assume all keys of “Eventtimestamp” do not have any corresponding value.What I want to do is: Batch process all files `event.txt` under `events`events	- event-1		- event.txt	- event-2		- event.txt	- event-3		- event.txtCreate a UNIX timestamp (epoch) from  the `Date` and `Time` values and add that timestamp after “Eventtimestamp: “Nothing else needs to be added or removed. Hope this clarifies what I’m trying to do. Best regards, Holger



-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
Title: 2019-01-04-14:00



Eventslug: reststrom



Date: 2019-01-04



Time: 14:00



Hidetime: 0



Status:



Locationid: theater



Hidetickets: 0



Line:



Eventtimestamp: 1546606800



Published: 2019-01-04 13:01
On 5 Jan 2019, at 3:22 AM, Christopher Stone  wrote:On 01/04/2019, at 09:56, 'Holger Bartel' via BBEdit Talk  wrote:I have a bunch of .yaml files in which I would like to replace/add one value with a timestamp, which needs to be created from two other fields/values. I think this needs the help of a filter/shell script and I’d love a pointer in the direction of how to achieve this.Hey Holger,It would be useful to have a couple of actual example files.You need to explain how you plan to access the files – what your actual workflow looks like.It appears that you're transforming from normal date/time to epoch time - yes?That transformation will definitely require some scripting.You say you need to replace/add one value – what does that mean?Are you needing to remove both the date and time stamps and replace them with the “Eventtimestamp”?Or are you needing to simply add the “Eventtimestamp” after the other stamps?--Best Regards,Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.




-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.