Hamilton LaboratoriesHamilton C shell 2012User guideSamples

splitstring.csh

Oregon Coast

splitstring.csh
Previous | Next

#  Split up a string into multiple lines, replacing each occurrence of
#  the separator text with a line breaks, writing them to stdout.

#  For example, write out the list of INCLUDE directories:
#
#     40 C% splitstring $INCLUDE ";"
#     C:\Users\Nicole\include
#     c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE
#     c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE
#     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include

#  Copyright (c) 2011-2012 by Hamilton Laboratories.  All rights reserved.

proc splitstring( input, separator )
   ( calc input ) | sed "s/$separator/^r^n/g"
end

@ splitstring( argv[ 0 ], argv[ 1 ] )

Previous | Next