Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (5) </ 1 2 3 4 [5] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: "Add to filetool.lst" button, In emelfm?< Next Oldest | Next Newest >
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: May 01 2005,21:06 QUOTE

WoofyDugFock,  I was really impressed by your code.  I learned a lot from the simplicity of your use of && and ||, as well as being able to use |'s rather than /'s in sed.  I didn't know that.  Having the error displayed after the procedure was really an eye opener for me.  I know I'll be doing that myself in the future.  I got duplicates when I tried your code though.  When I had the same files selected, I got multiple entries in filetool.lst when I hit the button multiple times.

If join works eliminating duplicates, then what was the problem with a duplicated filetool.lst?  Why should you need the extra sed statements?  Do all files get duplicated?

I went back to sort and uniq to change your code to:

Code Sample
a=~/filetool.lst && echo "Backup list:" && for i in %f; do echo %d/$i |sed "s/^\/\(ramdisk\)*\/*//" >> $a; done && cat $a | sort | uniq | tee  $a  && echo "Done." || echo "Error"


I didn't get duplicates, and filetool.lst wasn't repeated either.

The raw example is great: it's like a little microcosm of bash wonders.
Back to top
Profile PM 
WoofyDugfock
Unregistered






Posted: May 02 2005,13:14 QUOTE

Thanks heaps for your encouraging remarks, Clacker. I was beginning to wish I'd never opened my big fat mouth! Oh, these stumbling steps into bashhood!

Vertical pipes in sed?  I think you must be referring to my censored previous post - you must have been quick and read it before I deleted the "fix" - I found the same annoying bug myself so went back and plucked the foul offensive thing out! (The one with the echo at the front as you have it and the tee ..?).

I came to the same conclusion about |sort|uniq for appending rather than overwriting - I've been trying today to make join work for appending inside the do loop ( "join -v 1 - $a | tee -a $a etc )" but I'm tired of the buggy issues.

If it is of interest, I found getting rid of "join -v 1 - $a" writing filetool.lst's own name to $a though can be done - change the sed filter so that it blocks that filename -

Code Sample
sed "s|^/\(ramdisk\)*/*\($a\)*||;/^$/d"
Back to top
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: May 02 2005,14:45 QUOTE

The verticle pipes I was talking about was using the form

sed "s|whatever|whatevuh|"

instead of

sed "s/whatever/whatevuh/"

That helps with using /'s in the "whatever" sections.  I was using the \ character way to much because I didn't know you could start off and end using the | character.
Back to top
Profile PM 
22 replies since Mar. 27 2005,02:19 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (5) </ 1 2 3 4 [5] >/
reply to topic new topic new poll
Quick Reply: "Add to filetool.lst" button

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code