You are not logged in.
I need to write a small bash script to add a '-' to each line in a file before displaying via conky!
Todo
- Get Milk
- Buy Food
- Pay Bills
Currently I use
TEXT
Todo
${hr}
${head /home/mrgreen/.stuffigottado.txt 30 20}
In .conkyrc but have to add '-' each time I edit .stuffigottado.txt
Thanks in advance....
Mr Green
Offline
#!/bin/bash
cat ~/.stuffigottado.txt | sed -r "s/(.*)/- \1/" > filetobereadbyconky.txt
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
Wow! ...... thanks \o/
Mr Green
Offline
Yes that works too, removed extra space as its not required
though some sort of filter may be needed if line is empty ie /n
Its much better now thanks for your help :-)
Mr Green
Offline
To filter out blank lines, you could just modify the awk command:
${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
Offline
To filter out blank lines, you could just modify the awk command:
${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
very nice; awk and grep: two commands that never cease to amaze me.
//github/
Offline
That is awesome! will have to google what $_ means got an idea on some of it ...
Mr Green
Offline
awk runs commands on each "record" - usually a record is a line of input. From what I gather, $_ is the entire line of input (although most documentation I can find uses $0 for the same thing and doesn't even mention $_)
Offline