I want to cut each line in dat on '='.

dat=: <;._2 ]0 : 0
#This section defines display formats
Colors=Brown Pink Purple
Border=240 240 240  #color for borders
BlackWhite=
Default=200 200 200
)

Either of the following two statements will do this

   > '=' cut each dat   NB. >(<;._1@('='&,)) &.> dat
+-------------------------------------+-------------------------------+
|#This section defines display formats|                               |
+-------------------------------------+-------------------------------+
|Colors                               |Brown Pink Purple              |
+-------------------------------------+-------------------------------+
|Border                               |240 240 240  #color for borders|
+-------------------------------------+-------------------------------+
|BlackWhite                           |                               |
+-------------------------------------+-------------------------------+
|Default                              |200 200 200                    |
+-------------------------------------+-------------------------------+

If however I want any text on a line where '=' is not found to be in the 2nd 
rather than the first column. Can I do that more simply that the following?

   |."1 > |.@(<;._1@('='&,)) &.> dat
+----------+-------------------------------------+
|          |#This section defines display formats|
+----------+-------------------------------------+
|Colors    |Brown Pink Purple                    |
+----------+-------------------------------------+
|Border    |240 240 240  #color for borders      |
+----------+-------------------------------------+
|BlackWhite|                                     |
+----------+-------------------------------------+
|Default   |200 200 200                          |
+----------+-------------------------------------+
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to