Sponsored Content
Top Forums Shell Programming and Scripting Replacing end of line characters Post 302898486 by SriniShoo on Tuesday 22nd of April 2014 11:49:46 AM
Old 04-22-2014
Below code will create the filename ".tmp" files with the required changes.
Code:
for i in ~/Library/Calendars/*.calendar/Events/*.ics
do
  awk 'BEGIN{FS = OFS = "T"} {if($0 ~ /^DTSTART/ || $0 ~ /^DTEND/) {$NF = $NF - ($NF % 100)}}1' ${i} > ${i}.tmp
done

If you want to make the changes into the file, use below
Code:
for i in ~/Library/Calendars/*.calendar/Events/*.ics
do
  awk 'BEGIN{FS = OFS = "T"} {if($0 ~ /^DTSTART/ || $0 ~ /^DTEND/) {$NF = $NF - ($NF % 100)}}1' ${i} > ${i}.tmp && mv ${i}.tmp ${i}
done

This User Gave Thanks to SriniShoo For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing all but last Hex characters in a text line

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)
Discussion started by: BAH
2 Replies

2. Shell Programming and Scripting

Replacing characters in file with line break

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)
Discussion started by: johnemb
10 Replies

3. Shell Programming and Scripting

replacing certain characters with new line?

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)
Discussion started by: Bashar
4 Replies

4. Shell Programming and Scripting

Replacing end of line with " in a UNIX file

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)
Discussion started by: The Observer
2 Replies

5. UNIX for Dummies Questions & Answers

Inserting control characters at the end of each line

How to add control characters at the end of each line in a file? Can anyone help me with this? Thanks, Shobana (2 Replies)
Discussion started by: Shobana_s
2 Replies

6. Shell Programming and Scripting

Get the 1st 99 characters and add new line feed at the end of the line

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)
Discussion started by: udelalv
3 Replies

7. UNIX for Dummies Questions & Answers

Append characters to end of line

Coding in unix shell script. Hi All, Please help Thanks (6 Replies)
Discussion started by: sam12345
6 Replies

8. Shell Programming and Scripting

adding characters end of line where line begins with..

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)
Discussion started by: satnamx
6 Replies

9. UNIX for Dummies Questions & Answers

How to specify beginning-of-line/end-of-line characters inside a regex range

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)
Discussion started by: jawsnnn
3 Replies

10. Shell Programming and Scripting

sed - Removing all characters from token to end of line

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)
Discussion started by: jcdole
3 Replies
csa_list_calendars(library call)										  csa_list_calendars(library call)

NAME
csa_list_calendars -- list the calendars supported by a calendar service SYNOPSIS
#include <xcsa.h> CSA_return_code csa_list_calendars( CSA_service_reference calendar_service, CSA_uint32 *number_names, CSA_calendar_user **calendar_names, CSA_extension *list_calendars_extensions); DESCRIPTION
The csa_list_calendars function lists all the calendars supported by the specified calendar service. The names of the calendars supported are returned in calendar_names, which is an array of CSA_calendar_users structures with number_names elements. It is implementation spe- cific what authority a calendar user needs to invoke this function. ARGUMENTS
Calendar Service (Service Reference) Specifies the calendar service. A NULL pointer will reference the default calendar service name. If the calendar service name is invalid, then the error CSA_E_INVALID_CALENDAR_SERVICE is returned. If the user is not sufficiently autho- rized to list the calendars on the calendar service, then the error CSA_E_NO_AUTHORITY is returned. List Calendars Extensions (Extension) A pointer to an array of CSA_extension structures for this function. The array may contain both input extensions for providing additional information to the function and output extensions for receiving information from the function. A value of NULL indicates that the caller is not using any extensions. See the extensions structure for more information. RETURN VALUE
Number Names (Uint32) A pointer to the number of calendar names returned in calendar_names. A value of zero indicates that no calendars are known to the calen- dar service. The error CSA_E_INSUFFICIENT_MEMORY is returned if the service has insufficient memory to store the complete set of requested information. Calendar Names (Calendar User) A pointer to the array of calendar user structures, representing the calendars supported by the specified calendar service. This pointer is allocated by the service, and should be freed with a single call to csa_free(3). List Calendars Extensions (Extension) If output extensions were passed to the function in the extensions list, the results from the service will be available in the extension. See the extension structure for more information. Indicates whether the function succeeded or not, and, if not, why. It may be success or one of the values listed under ERRORS below. ERRORS
The csa_list_calendars function returns the following error values: CSA_E_FAILURE There was a general failure that does not fit the description of any other error code. CSA_E_INSUFFICIENT_MEMORY Insufficient memory was available to complete the requested operation. CSA_E_INVALID_CALENDAR_SERVICE The underlying calendar service is invalid, so logging on cannot be completed. CSA_E_INVALID_FLAG A flag value in the flags argument was invalid. CSA_E_INVALID_FUNCTION_EXT The function extension requested is invalid. CSA_E_INVALID_PARAMETER A function parameter was invalid. CSA_E_NO_AUTHORITY The user has insufficient authority for this function. CSA_E_NOT_SUPPORTED The operation requested is not supported by this implementation. CSA_E_SERVICE_UNAVAILABLE The requested calendar service is unavailable. CSA_E_UNSUPPORTED_FUNCTION_EXT The specified function extension is not supported or CSA_EXT_REQUIRED is set. SEE ALSO
csa/csa.h - csacsa(5), csa_add_calendar(3), csa_add_entry(3), csa_call_callbacks(3), csa_delete_calendar(3), csa_delete_entry(3), csa_free(3), csa_free_time_search(3), csa_list_calendar_attributes(3), csa_list_entries(3), csa_list_entry_attributes(3), csa_list_entry_sequence(3), csa_logoff(3), csa_logon(3), csa_look_up(3), csa_query_configuration(3), csa_read_calendar_attributes(3), csa_read_entry_attributes(3), csa_read_next_reminder(3), csa_register_callback(3), csa_unregister_callback(3), csa_update_calen- dar_attributes(3), csa_update_entry_attributes(3). csa_list_calendars(library call)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy