From: "Suraj N. Kurapati" Date: 2006-08-13T10:35:38+09:00 Subject: Re: Parse/Split `cmd` -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 tjones wrote: > One very simple thing I do a lot in my TCL scripts is parse the output > from a cmd it would read [split $x \n]. Use $x.split, which works on newlines by default. > OK, I have a def defined to run my command line app and I want to split > the result at the line ending, how do I do it? I have tried split(\n) > and I get a error. irb(main):001:0> s = "foo\nbar" => "foo\nbar" irb(main):002:0> s.split => ["foo", "bar"] irb(main):003:0> s.split "\n" => ["foo", "bar"] irb(main):004:0> s.split '\n' => ["foo\nbar"] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFE3oG1mV9O7RYnKMcRArdTAKCVfaDz+7c+7NEmANm0Jmyf3bmeFgCgk5SP r210B4lLIt295WThfDYoQdU= =WWlR -----END PGP SIGNATURE-----