| |
| |
| |
|
Page: 1 2
Comments:
<0> i believe the term you're looking for is "Space Ranger" <1> heh <0> ;-) <2> Power Rangers > * <0> heh <3> is there a simple way to convert every first letter of every word to a capital? <2> yes. <3> oh sweet. what is it? <2> Well, it is, if you have GNU sed. <3> yeah I do <3> screw that ancient crap, I'm running Gnu/Linux! <4> shad0w1e: echo "abcd efg. hij klmno" |sed -e 's/^.\| ./\U&/g' #Abcd Efg. Hij Klmno <3> gnubien, hey thanks <4> shad0w1e: sure, its not perfect, its only a working kludge <3> looks pretty damn perfect to me. I'll change whatever necessary manually. it's not that much stuff. thank you <4> shad0w1e: have fun ;)
<5> i want to forward the output of ls to sed and find all the files that begin with a.how can i do it with sed? <6> ls | sed -n '/^a.how/p' <6> bye - gotta go <6> l8r <7> this may be google-able but i haven't figured out a good way to google it <7> i want to be able to use sed to match only things that are inside or outside of dialogue in an ebook <7> the theory is that the number of " should be even <7> so one search I might want to only search outside of ""... I think I could figure out how to use sed to delete such sections <7> but i'd prefer it if i could somehow mark them for later searching <7> the problem being multilines? although i'm not sure if this is a problem <8> lydgate, you might be better off writing your own little parser for this. <7> Rado: really? would this be difficult? <7> hmm ok <7> so what's easier, figuring it out in sed or learning enough perl to do it <7> ***uming no perl, only python and c as a hobbyist... <8> lydgate, sed has only 2 "variables", not much for complex tasks like "counting". <7> hmm ok <8> But ... for learning purpose you could/should try it in sed. <7> yeah, i'm going to at least mess with it <8> At least I could learn from it when you find out :) <7> i want to see if i can first eliminate all quoted p***ages from a text <7> i'm sure sed can do that <7> yeah so, turns out 46% of the brothers karamazov is dialogue :P <5> Rado, what did you meant when you said sed has only 2 variables? <8> To program stuff you need variables to store states, sed has only 2: pattern space and hold space. <8> And both of them are just stupid strings, no arithmetics. <7> hmm this doesn't work quite as well as hoped, apparently grepping for 2000 lines in 32000 lines is a slow operation <7> grepping for 2000 patterns rather <8> Ehh, why would you want to do _that_? <0> sounds like it's time for a database with a join command <7> yeah <7> i'm being inefficient, still working out what the best way to do this is <7> given an arbitrary novel which is good about using "" to indicate dialogue, I want to separate the narration from the dialogue <7> then be able to search either half with regex, then find it again in the main text <0> you could try sed '/"/,/"/d' <7> yes that seems to work... although wouldn't that delete the whole line, not just what's between the ""? <7> yes, and if there are two instances of a single word like this: "word" it will delete all the lines between them <0> hrm, that's a good question. try it on a test file and see <7> i think i got it, it's a bit more complicated <7> from googling around, adapting a script that removes <> from html <7> but it seems to work <7> it's 9 lines but i can paste it if you're interested <7> actually it works kind of beautifully <0> nah, i'm into something else right now. thanks <7> yeah no problem, thanks for your suggestion <0> ;-) <8> lydgate, /topic -> paste <7> http://rafb.net/p/6aLdGN82.html <5> lydgate, another approach a little bit more mathematic could be to work with cut <7> marinosi: but how would that work with multiline quotes? <5> for example cat _file_ | grep -c <5> for example cat _file_ | grep -c '"' <5> and then cut -f 1,3,..., `cat _file_ | grep -c '"' ` -1 -d '"' <7> that would tell you how many quotes there were in the file... <7> ok let me test it out <5> i can make it for you if you wnat <7> yeah i'm interested, i don't see how it would work <5> i just need a little to test it <7> ok i'll paste you some text <7> marinosi: http://rafb.net/p/dhsyIK14.nln.html
<5> the problem is that grep counts lines that have the wanted char and not how many chars..ahmmm <7> this is what the sed script gives: http://rafb.net/p/DDJJRl16.html <7> which is actually pretty impressive <5> lydgate i have to go now but i will prepare it for you later..Could you please give me your email to send it to you? <7> sure <5> it is challenge for me and it worths a try :D <7> sed@lydgate.e4ward.com <5> thanks <5> :D <5> when i come back i ll make it <7> ok cool <9> If I want to remove everything inclusively between <style.* and </style>, so I want sed '/<style.*/,/<\/style>/d' file > tmp && mv tmp file ? <9> seems to work... Any suggestions for a better way? <2> "Your sed might have -i." <9> :P <9> Does sed exit with nonzero exit status if it doesn't find a match in a file? <8> kojiro, your "man sed" should tell you all exit codes. <9> Rado: I tried searching for the word 'exit' or 'nonzero' or 'zero' but came up with nothing <8> search no-case <9> I also checked info sed, but didn't see a topic that applied. OK <9> a case-insensitive search had two hits on 'exit'; --help and --version <0> search for "exit <0> " <9> er... <9> I am <9> now I'm searching info sed <9> I guess you have to explicitly use q and say which exit code you want? <9> which makes sed like an inversible grep <9> since it only accepts one address <0> you are using gnu sed? <9> yes <0> ok, standard sed has a line on "exit" but i don't see anything in gnu sed yet <9> beebum: in info sed I found 'q [EXIT-CODE]' <0> oh, that isn't what you are looking for <9> Maybe I should just state what I really want <9> :) <9> but it's kinda complex so I'll pastebin it <9> http://rafb.net/p/cUMkgM56.html <9> When you boil it down, that's what I need. <0> that "...isn't the last InstanceEndEditable in the given document." part is beyond me but i can probably do the rest of it. :-/ <9> hmm <9> if you nuke from <!-- InstanceEndEditable --> to the end of the file that's a problem :/ <0> no, it wouldn't do that <0> it would just nuke every Begin/End range in the document <9> err, no, I need to nuke from End to Begin <9> I.e. closing up the gaps <0> ok <9> but only the ones inside the <body> -- the <head> is already finished <0> ok, i think i can do that <9> If that's easy for you, great, but I would just as soon learn it myself if you can show me... So far I've been doing it with pipes <9> i.e. sed -n '/<body>/,/<\/body>/p' | sed ... <0> use -e <2> or ; <9> right, but one starts with -n and the other doesn't <2> kojiro: if what begins with <body> ? <9> goldfish: I'm trying to close up editable regions with the <body>...</body> part of an html template <0> kojiro, if you use -n you will not get all the other stuff you want, only the stuff you are trying to delete. <2> I want to inclusively remove everything from '<!-- InstanceEndEditable -->' <2> to the next '<!-- InstanceBeginEditable name="[^"]*" -->', but only when it <2> begins within '<body>' <2> so like <body> wold be the line above, <!-- Instance .... ? <9> goldfish: right, only when <!-- InstanceBegin/End --> fall within <body> and </body> <2> k <0> brb <9> goldfish: <body> could be many lines about <!-- Instance... <9> s/about/above <2> sed -n '/<body>/,/<\/body>/{/<!-- InstanceEndEditable -->/,/<!-- InstanceBeginEditable name="[^"]*" -->/d;p}' <2> Won't work, for your "only if it isn't the last blah in file" eh, criteria, or whatever. <2> And may not work for any other parts of it :) I didn't test it much. <9> wow <9> I actually understand that, now that you point it out <0> i think it will work for the "last" part <0> since you are going from end to begin
Return to
#sed or Go to some related
logs:
#suse Unknown tag: %kmdl madwifi
VarStructor #web #php Ubuntu mouse not workin disable-pcmcia debian sed literal new line phprox #math
|
|