diff --git a/dist/tools/openocd/openocd.sh b/dist/tools/openocd/openocd.sh
index a4c72dd38696ed501bfd17e2c8de73b4c8dcc0c7..ba50e5b1cd56e2075a116edeb99c88a518d2fb88 100755
--- a/dist/tools/openocd/openocd.sh
+++ b/dist/tools/openocd/openocd.sh
@@ -159,6 +159,20 @@ _is_binfile() {
         [[ -z "${firmware_type}" ]] && _has_bin_extension "${firmware}"; }
 }
 
+# Split bank info on different lines without the '{}'
+_split_banks() {
+    # Input:
+    #   ...
+    #   {name nrf51 base 0 size 0 bus_width 1 chip_width 1} {name nrf51 base 268439552 size 0 bus_width 1 chip_width 1}
+    #   ...
+    #
+    # Output:
+    #   name nrf51 base 0 size 0 bus_width 1 chip_width 1
+    #   name nrf51 base 268439552 size 0 bus_width 1 chip_width 1
+
+    sed -n '/^{.*}$/ {s/\} /\}\n/g;s/[{}]//g;p}'
+}
+
 # Outputs bank info on different lines without the '{}'
 _flash_list() {
     # Openocd output for 'flash list' is
@@ -169,7 +183,7 @@ _flash_list() {
             ${OPENOCD_ADAPTER_INIT} \
             -f '${OPENOCD_CONFIG}' \
             -c 'flash list' \
-            -c 'shutdown'" 2>&1 | sed -n '/^{.*}$/ {s/\} /\}\n/g;s/[{}]//g;p}'
+            -c 'shutdown'" 2>&1 | _split_banks
 }
 
 # Print flash address for 'bank_num' num defaults to 1