blob: 9251813ffb724cd86614a9f1670d2baf1945e9c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
. "$1"
feed() { # feed NAME URL BASE_URL ENCODING
name="$1"
url="$2"
base="$3"
encoding="$4"
shift 4
printf '%s\t%s\t%s' "$name" "$url" "${base:-}"
printf '\t%s' "$@"
printf '\n'
}
DIR="${SFEED_DATA:-$HOME/.sfeed}/urls"
mkdir -p "$DIR"
feeds | awk -v dir="$DIR" '
BEGIN{FS="\t";}
{
gsub(/\//, "_", $1);
file = dir "/" $1;
if ($2) print $2 > file;
if ($3) print $3 >> file;
for (i=4;i<=NF;i++) {
print $i >> file;
}
close(file);
}'
|