From e367533eb8bb5da19679cc55bf605a79514a407e Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Tue, 28 Mar 2017 23:15:35 +0800 Subject: [PATCH] [Refactor] Reduce one more `sed` & pipe to speedup --- nvm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index cea5a8b..9fa2fb6 100644 --- a/nvm.sh +++ b/nvm.sh @@ -1083,9 +1083,9 @@ nvm_ls() { \\#${SEARCH_PATTERN}# !d; " \ -e 's#^\([^/]\{1,\}\)/\(.*\)$#\2.\1#;' \ + -e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' \ + -e "s#^${NVM_NODE_PREFIX}-##;" \ | command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n \ - | command sed -e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' \ - -e "s#^${NVM_NODE_PREFIX}-##;" \ )" fi fi