summaryrefslogtreecommitdiff
path: root/contrib/reclist/vdr_crop_output.sh
blob: 80df4f34b99e641a930a4c48fe14d772008e34a1 (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
31
32
33
34
#!/bin/bash

PRGNAME=$(basename $0)

usage() {
    echo "usage: ${PRGNAME} (all|head|tail)"
}

what=${1}
if [[ -z ${what} ]]; then
    usage
    exit
fi



# set values for the positions of each column and the sortpositions
. vdr_set_values_for_recording_lists.sh



# crop vertically / lines
if   [ "$what" == "head" ] ; then
    LINEFILTER=" head -n ${LINES_PER_PAGE} |"
elif [ "$what" == "tail" ] ; then
    LINEFILTER=" tail -n ${LINES_PER_PAGE} |"
else
    LINEFILTER=""
fi


COMMAND="cat /dev/stdin | ${LINEFILTER} cut -b 1-${CHARS_PER_LINE}"
#echo "cmd: ${COMMAND}"
eval "${COMMAND}"