Hi Esa, This is a quick and dirty way:
;(],&LF)&.> 'Test';'ing';'elephant' Cheers, David On 3/18/2019 09:26, Lippu Esa wrote:
Hello, I need to write out a text file with variable length lines and no trailing spaces. I can do it externally with sed but I'd prefer do it the J way. However, I can't figure it out. Any help would be greatly appreciated. Esa require '~addons/general/misc/format.ijs' 1!: 44 'c:/temp' ]rows=:4 1 $;:'one two three four' NB. the real file is a .csv from Excel +-----+ |one | +-----+ |two | +-----+ |three| +-----+ |four | +-----+ (,"2>rows) fwrites 'testfile' 28 NB. test file has unwanted trailing spaces hexdump shell 'type testfile' 00 6F 6E 65 20-20 0D 0A 74 77 6F 20 20-0D 0A 74 68 |one ..two ..th| 10 72 65 65 0D-0A 66 6F 75 72 20 0D 0A |ree..four .. | NB. desired result hexdump shell 'sed ''s/ *$//'' testfile' 00 6F 6E 65 0D-0A 74 77 6F 0D 0A 74 68-72 65 65 0D |one..two..three.| 10 0A 66 6F 75-72 0D 0A |.four.. | --- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm