SHARE
TWEET

Скрипт для создания DjVu-букмарков (аналог программы bookm)

nbl Jun 10th, 2011 221 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN {
  2.     vlozh = 20
  3.     for (i=1; i <= vlozh; i++) {
  4.         off[i] = ""
  5.         for (j=1; j <= i; j++) {
  6.             off[i] = off[i] " "
  7.         }
  8.     }
  9.     last_uroven = 0
  10.     print "(bookmarks"
  11. }
  12. {
  13.     uroven = 1
  14.     for (i=1; i <= vlozh; i++) {
  15.         if (substr($0, i, 1) == "\t") {
  16.             uroven += 1
  17.         } else {
  18.             break
  19.         }
  20.     }
  21.     out_str = $1
  22.     for (i=2; i < NF; i++) {
  23.         out_str = out_str " " $i
  24.     }
  25.     page = $NF
  26.     while (uroven <= last_uroven) {
  27.         print off[last_uroven] ")"
  28.         last_uroven--
  29.     }
  30.     print off[uroven] "(\"" out_str "\" \"#" page "\""
  31.     last_uroven = uroven
  32. }
  33. END {
  34.     do {
  35.         print off[last_uroven] ")"
  36.         --last_uroven
  37.     } while (last_uroven > 0)
  38.     print ")"
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top