SED command line utility – split string (& grep)

SED is a useful Unix command line tool I use for simple text replacement.

Here’s an example to see the directories included in your Windows PATH environment variable.  (I use MinGW for a Unix-like Shell in Windows)

echo $PATH

displays all directories on one line separated by semicolons.

With sed, we can list each directory on its own line.

echo $PATH | sed 's/:/\n/g'

First we echo $PATH, then pipe the output to the sed command to do our string replacement. The /g modifier will substitute ALL matches, not just the first.

Now each directory is listed on a separate line.

Additionally, if you are looking for a specific directory, for example you want to see which SVN installation is included in your PATH, you can use the grep command.

echo $PATH | sed -e 's/:/\n/g' | grep -i 'svn'

Once again we pipe the output from sed and use grep to show only directories that include SVN. The -i option is to ignore case (if your folder name includes the text “Svn”, “SVN”, etc.)

Maven Debug Jenkins Plugin in Eclipse

Attach debugger to Eclipse:

  1. Right click your Project
  2. Debug As > Debug Configurations
  3. Remote Java Application
  4. New. I name it a generic name like “Remote myapp”, you can change it to another Project by clicking Browse and selecting a Project. Or you can set up the debugger for each project if you wish.
  5. Close
  6. From the command line inside your project directory, type:
  7. mvnDebug -DJENKINS_HOME="C:\Program Files (x86)\Jenkins" -Dport=9090 hpi:run

  8. Go back to Eclipse (set your breakpoints) and press “ALT + SHIFT + D, D” to start debugging your project
  9. Once it says “Jenkins is up and fully running”, open a browser and type your Jenkins instance URL and port number, i.e. http://localhost:9090
  10. Click the link below