From f8f0ca1fd499cd387971c37e90bcdbccc4fa549c Mon Sep 17 00:00:00 2001 From: David Irwin Date: Mon, 30 May 2022 11:58:29 +0100 Subject: [PATCH] Added line to replace Carriage Returns with newline --- .../01 Ruby/0015 - Import or Export RTC to txt/UI_script.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/01 InfoWorks ICM/01 Ruby/0015 - Import or Export RTC to txt/UI_script.rb b/01 InfoWorks ICM/01 Ruby/0015 - Import or Export RTC to txt/UI_script.rb index 52892025..30db8d45 100644 --- a/01 InfoWorks ICM/01 Ruby/0015 - Import or Export RTC to txt/UI_script.rb +++ b/01 InfoWorks ICM/01 Ruby/0015 - Import or Export RTC to txt/UI_script.rb @@ -13,6 +13,8 @@ # Example 1: Export RTC from current network to a txt file if mode == 1 rtc_string = row_object['rtc_data'] + #remove carriage returns (\r\n) and replace with newline (\n) + rtc_string = rtc_string.gsub(/\r\n?/, "\n") File.open(path + exported_file, 'w') { |file| file.write(rtc_string) } puts "File \'#{exported_file}\' exported to path \'#{path}\'" end