From: paul Date: Sun, 3 Dec 2017 15:04:54 +0000 (+0000) Subject: quicker rename function X-Git-Url: https://git.plutz.net/?p=bookman;a=commitdiff_plain;h=408a5fe49cabd0d7c025e86f9fb0053e57385ef3 quicker rename function svn path=/trunk/; revision=10 --- diff --git a/index.cgi b/index.cgi index 00006da..12caed1 100755 --- a/index.cgi +++ b/index.cgi @@ -160,10 +160,7 @@ case "$(GET action)" in fid="$(POST fid | checkid)" file="${BDB}/${fid}.bm" if [ "$(POST control)" = confirm -a -n "$name" -a -f "$file" ]; then - order="$(head -n1 "$file" |cut -f3 || printf 1000)" - printf '%s\t%s\t%s\n' "$fid" "$(HTML "$name")" "$order" >"${file%.bm}.tmp" - tail -n+2 "$file" >>"${file%.bm}.tmp" - mv "${file%.bm}.tmp" "$file" + sed -ri "1s'^(${fid}\t)[^\t]+(\t.+)$'\1${name}\2';" "$file" fi REDIRECT "${SCRIPT_NAME}#${fid}" ;;