on f3ca521 help sign in
urbit.org/weights.sh
23 lines 575 B history raw
1#!/bin/bash
3EDITOR=${EDITOR:-atom}
5# build weights file
6for file in $(find -type f -name \*.md); do
7 [[ $file == *_index.md ]] && continue
8 echo $(grep -m 1 "weight = " $file | sed 's/^weight = //') $file
9done | sort -n > weights
11# edit weights file
12$EDITOR weights
13read -p "Edit weights and press enter to continue..."
15# for each line in weights file, read values weight and file, and update
16# $weight in $file
17cat weights | while read weight file; do
18 echo $weight $file
19 sed -i'' "s/^weight = [.0-9]*/weight = $weight/" $file
20done
22# remove weights file
23rm weights