Question: I'd like to split the following GST command into two halves using shell script.

`/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0KAHukBQHpCAAAH0AAB1MAI\\,aM48gA\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075`

The split has to occur at caps =
The two new lines should be stored in two variables $var1 and $var2

$var1 should contain
`/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink:`

And $var2 should contain
`application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0KAHukBQHpCAAAH0AAB1MAI\\,aM48gA\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075`

Remember there are two backslashes in the input string. So doing an echo will give only one backslash.

Answer: 
This is weird, because I find without a Read Eval Print Loop (REPL) in the languages you're used to, I'm forever frustrated by how much work it is to test my code as I go along. The REPL is fundamental to my incremental code development; you can use it to test your code *without* having to add a bunch of print statements.

* Have GHCi open at the same time as your editor.
* Write smaller, single-purpose functions. This seems bizzare at first, but function application is the basic unit of work in Haskell and doesn't have the sort of overheads you get in imperative languages.
* Each time you write a function, do `:r` in GHCi and test it with a variety of input.
* Haskell is very dense, so what counts as worth making into a separate function is much shorter on the screen than you're used to.

Occasionally you end up stuck in a lengthy monadic computation or something. GHCi lets you set breakpoints - use these in preference to adding print statements to the code because you can mess about and investigate a bit more without editing code, and most importantly, you don't need to add Show constraints on your type signatures.

When you're done, you can manually inline gratuitously short helper functions and compile with `ghc -O2`. 

(Using manually added print statements, or `Debug.Trace` module is a complete pain compared to this in my experience.)

**Summary**: Whenever possible, avoid editing your code while testing it. Use GHCi a lot.
First, you can debug your functions by loading them into `ghci` and playing with them there. 

Then, you can use `trace` from [`Debug.Trace`](http://hackage.haskell.org/packages/archive/base/latest/doc/html/Debug-Trace.html) to print a string when an expression is evaluated. However be aware that since Haskell uses lazy evaluation, in most cases an expression will be evaluated at a different time than you'd expect. See also [Wikibooks](http://en.wikibooks.org/wiki/Haskell/Debugging) and [Haskell wiki](http://www.haskell.org/haskellwiki/Debugging#Printf_and_friends). (Internally `trace` uses unsafe calls that allow it to print output even within pure code. Normally you're not supposed to use them, but in this particular case it is OK.)