Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

Reply
 
Thread Tools Display Modes
Old 23-06-2008, 16:15   #11
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

*click* bought.
__________________
Goose is offline   Reply With Quote
Old 23-06-2008, 16:23   #12
LeperousDust
Bananaman
 
LeperousDust's Avatar
 
Join Date: Jul 2006
Location: Liverpool/Edinburgh
Posts: 4,817
Default

Jesus, that actually looks foreign to me...
__________________
LeperousDust is offline   Reply With Quote
Old 23-06-2008, 16:48   #13
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

Book shmook, got there in the end.

Still, it's a handy thing to learn.
__________________
Goose is offline   Reply With Quote
Old 07-10-2008, 10:09   #14
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

Quote:
Originally Posted by Mark View Post
The fact you can have more than one pattern per line caused me some major grief, but if it's OK to use sed twice, then I managed to get around that one:

Code:
sed '/\(<<[^<>]*>>\)/s//\n\1\n/g' | sed '/^<<\([^<>]*\)>>$/s//\1/p;d'
The first sed breaks out the <<...>> so that each is split out onto a line by itself, then the second one picks out just those lines.
Just realised this screws up when it comes across something like:
Code:
abcdefgh<<ijklmno>pqrst>>uvwxyz
abcdefgh<<ijklmno<pqrst>>uvwxyz
__________________
Goose is offline   Reply With Quote
Old 07-10-2008, 11:19   #15
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

You may have reached the limits of what sed can do for you there. It'll also break with this one:
Code:
abcdefgh<<ijklmno<>pqrst>>uvwxyz
Mark is offline   Reply With Quote
Old 07-10-2008, 11:21   #16
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

Any suggestions, Mr Mark? I think I need to buy you a pub...
__________________
Goose is offline   Reply With Quote
Old 07-10-2008, 11:31   #17
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

Windows or Linux? There's a way to cheat it that I hadn't thought of before, but I'll have to put it into a script as it uses unprintable characters.
Mark is offline   Reply With Quote
Old 07-10-2008, 11:33   #18
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

Linux. Any suggestions would be more than welcome.
__________________
Goose is offline   Reply With Quote
Old 07-10-2008, 11:45   #19
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

OK - one more.

If I gave it:

Code:
abcdefg<<<<hijkl>>mno>>pqrstuvwxyz
Would the answer 'hijkl' be OK, or do you want '<<hijkl>>mno', or is that just a case of 'never going to happen'?

I've solved all the other cases, but this one might resist.
Mark is offline   Reply With Quote
Old 07-10-2008, 11:55   #20
Goose
The list is long, but distinguished
 
Goose's Avatar
 
Join Date: Dec 2006
Location: Århus, Denmark
Posts: 1,643
Default

It'd never exist. The '<<' and '>>' will always match, there may be more than 1 per line, they would never overlap, and there may be single '<' and '>' in each.
__________________
Goose is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 17:52.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.