Skip to content
Browse files

* Better sed pattern to match key.

  • Loading branch information...
1 parent 193fc01 commit d7f81051141a86b5bd95dff786d9a4d5a200248a @perusio committed Jan 14, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 nginx-cache-inspector
View
9 nginx-cache-inspector
@@ -61,13 +61,12 @@ function get_cache_files() {
## is to filter.
function get_cache_item_key() {
if [ $# -eq 1 ]; then
- local key_line=$(cat $1 | sed -n '2p' | cut -f 2 -d ':')
+ local key_line=$(cat $1 | sed -n '/^KEY:/p' | cut -f 2 -d ':')
## Filter all non ASCII based keys.
- if echo $key_line | grep -q -vP '[^[:print:]]'; then
- echo $key_line
- fi
+ echo $key_line | grep -q -vP '[^[:print:]]'
+
else
- cat $1 | sed -n '2p' | cut -f 2 -d ':'
+ cat $1 | sed -n '/^KEY:/p' | cut -f 2 -d ':'
fi
} # get_cache_item_key

0 comments on commit d7f8105

Please sign in to comment.
Something went wrong with that request. Please try again.