View Single Post
spankincubus

 
Member Since: Feb 04, 2012
Posts: 4
spankincubus is on a distinguished road

spankincubus is offline
thanks guys.. im stupid.. it was indeed the tr and sed.. i copied and pasted the code. and the ^I(tabs) got transformed to single spaces.

Silly of me. Sorry to waste you guys time..

its working perfectly now.

However i was thinking of refining it some more. i was thinking of making the output of the txt scrollable ie. print lines 0-10, then 11-21 ,.. and so on .. until end of file is reached.
the code is working on command line (see below) but when i call the script in the geektool, it doesnt show anything. any recommendations?

CODE

localhost:geeklets root# cat scroll.sh
#!/bin/ksh

typeset -i start=1
end=`wc -l test.txt|awk -F" " '{print $1}'`
typeset -i end1=$start+10
echo $start $end $end1

while [[ $start -lt $end ]]; do
clear
str="'${start},${end1}p' test.txt"
echo "sed -n $str"|/bin/ksh
start=${start}+1
end1=${end1}+1
sleep 1
done
QUOTE Thanks