I'm looking for some help in renaming data-timestamps stored within different calendar directories/files.
The calendar directory has hundreds of ICS files:
A single ICS file usually holds the following example data:
My goal is to rename any DTSTART/DTEND line in all directories and files that doesn't end with 00 to end (replace) with 00
DTSTART;TZID=Europe/London:20131017T151512 should become
DTSTART;TZID=Europe/London:20131017T151500
as well as
DTEND;TZID=Europe/London:20131017T154059 should become
DTEND;TZID=Europe/London:20131017T154000
So far my command does the following:
1) Find .ICS files in directory
2) Only use lines that have DTSTART or DTEND in it
3) Remove the OSX line ending
4) Find lines that don't end with 00
However, I've been unable to find a way to replace the last two digits to 00 and write it directly to the files. Apparently sed '/00$/!s/..$/00/' does some magic but I don't understand the exact syntax and it also doesn't write it to the files!
Unfortunately I'm forced to do this on OSX Mavericks 10.9 and it looks like the -i option in sed is handled differently - also discussed in this thread: stackoverflow.com/questions/2320564/variations-of-sed-between-osx-and-gnu-linux
@Subbeh: I've been running all four variations without an error but the date/time string stays unchanged - I need to do more testing later as I assume it's still the ^M line ending that breaks it..
@Scrutinizer: The loop also works when I remove .bak:
Hello.
The token is any printable characters between 2 " .
The token is unknown, but we know that it is between 2 "
Tok 1 : "1234x567"
Tok 2 : "A3b6+None"
Tok 3 : "A3b6!1234=@"
The ligne is :
Line 1 :
"9876xABCDE"Do you have any code fragments or data samples in your post
Line 2 : ... (3 Replies)
How can I specify special meaning characters like ^ or $ inside a regex range. e.g
Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character.
I tried the following but it does not work:
sed 's/\(\)/<do something here>/g' file1
... (3 Replies)
Hi all,
using VI, can anyone tell me how to add some characters onto the end of a line where the line begins with certain charactars eg
a,b,c,.......,
r,s,t,........,
a,b,c,.......,
all lines in the above example starting with a,b,c, I want to add an x at the end of the line so the... (6 Replies)
I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed).
AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC
MY * A02 RESALE 6990788000 Y... (3 Replies)
How should I replace End of line Character by ".
i.e in a file -
Name1,NO1
Name2,No2
Name3,No3
....
Should look like --
Name1,NO1"
Name2,No2"
Name3,No3"
.... (2 Replies)
i have a text file which domains something like this
123213213213/32434342
324324324/12312321321
12321321,435435435
12321312 / 12313213 / 12435435345
4353213 , 123213213213
21321321312-12334324
234324324 - 235645645645
456456456 - 45456456456 - 45645645654243
how can i replace '/' and... (4 Replies)
Hi,
Apologies if this has been asked before, but I searched and was not able to find an answer. It's probably a simple question to answer for those of you with some experience, though...
I have a relatively long string where tokens are separated by the colon (':') character. Let's say the... (10 Replies)
I must remove hex characters 0A and 0D from several fields within an MS Access Table. Since I don't think it can be done in Access, I am trying here.
I am exporting a Table from Access (must be fixed length fields, I think, for my idea to work here) into a text format.
I then want to run a... (2 Replies)