| |
| |
| |
|
Comments:
<0> hi I'm just starting with sed, and I'm having difficulty removing a ' from an input line <0> sed 's/\'//' is asking me for a matching ' <0> what am i doing wrong? sed s/'// doesn't work either <0> um this is in a pipeline if that makes a difference? <0> OK, I need a sed cmd to get rid of [, ] or ' (3 chars) in an input line- can anyone help please? <1> sed s/"'"//g file <0> thanks beebum, got same answer in bash <0> glad you're awake tho ;) <1> heh, i'm not awake ;-P <2> igli: sed 's/[]['\'']//g'
<0> what you're sleep-typing? that's dangerous m8 <0> goedel: sed "s/[],'[]//g" which looks really funky <0> (sorry added a ,) <0> sed "s/[]'[]//g" looks mad but works <0> goedel: i can't scan your version. are the extra ' chars to deal with ' as string delimiter? <2> igli in '\'' the first quote ends the string before; \' is an escaped quote; and the third quote starts the next string <2> igli: so you can embed a single quote in a single quotes delimited string in bash <0> now ic - was wondering about interaction with bash, but it's all bash <0> everything's a string <0> if i wanted to delete strings of the form UNKNOWN_nn where n is a digit would that be sed s/UNKNOWN_[0-9][0-9]//g ? <0> more to the point, how do i combine that with the previous cmd to execute in one invocation? <0> sed "s/[]'[]//g" -e s/UNKNOWN_[0-9][0-9]//g ? <0> try it and see.. <2> sed "s/[]'[]//g;s/UNKNOWN_[0-9][0-9]//g" <0> lovely, ty goedel <2> np igli <0> :) <3> hi <4> yes <3> I have lines like "memberUid: <variable_string>,ou=....." . I want to remove all starting from the "," (including it). How can sed manage that ? <4> sed 's/,.*//' <3> ho, it's that simple. Thanks <3> but no <4> elshaa: provided you dont have more than one , and you want to remove only from the second onwards <3> no, the "memberUid: " in from of the line is important. <3> almost all lines in the file contains ",.*" <4> $ echo "memberUid: <variable_string>,ou=....." | sed 's/,.*//' <4> memberUid: <variable_string> <4> what are you looking for then <5> and you only want to do it on lines containing memberUid: ? <3> echo "stuff: <variable_string>,ou=....." | sed 's/,.*//' <3> stuff: <variable_string> <4> that is not what you need ? <3> I only want lines with leading "memberUid" to be replaced <4> ah <4> goldfish: you are good at guessing :)
<5> oh yes! <4> sed '/memberUid/s/,.*//' <4> sed '/^memberUid:/s/,.*//' better <3> thanks ! <4> specifiy your requirements completely. not everyone is good at guessing like goldfish :) <3> ok :) <6> hi, I'm just wondering about a sed command - here: http://dpaste.com/4895/ for some reason webalizer.conf is always empty after I run the script, and webalizer doesn't work (obviously) after this... what am I doing wrong? <5> Use a temp file. <5> sed 's///' file > tmpfile && mv tmpfile file <5> also, for f in logs/access*; do ...; done <5> don't use for f in $(ls) <6> right, thanks <7> genelisp: some seds suport -i <1> that's very strange, i use webalizer off and on and have not seen that problem <1> i'm curious to know what's causing it to wipe out the .conf file <5> his redirection. <1> ah <1> just opened the link <6> goldfish, ok, I changed it, and it works :-) but... it's appending 'logs/logfile' to the line - what modification could I make so it just adds 'logfile'? <5> oh, you're using $f in the sed. <6> yes <5> ${f#*/} <6> many thanks :-) I'll give it a go - I'm rubbish at bash :-S <5> Or just hardcore it in. <5> #bash -- where all your dreams come true <8> oh my :) <9> hey guys, i've got a log that i need to preprocess, i have a line like this: <9> 10.1.5.170 - - [22/Jan/2007:14:07:01 -0700] "GET /blah HTTP/1.0" 200 25 "-" "Wget/1.10.1 (Red Hat modified)" "someip:53575 -> 10.1.5.170:80" <9> and i want to get the 'someip' part at the front <9> and replace that 10.1.5.170 at the front <9> any idea? <9> sed 's/\(.*\) \(.*\) \(.*\) \(.*\)/\2 \1 \4 \3/' sort of does the trick lol <9> quite a hack <8> i would have done a similar thing, maybe anchored to $ <8> prec? <9> sed 's/\(.*\) "\(.*\):\(.*\) \(.*\)/\2 \1 \4 \3/' is good enough <9> prec ? <8> a person <8> well, maybe not a person, more a semi-sed-god <8> "semi" - bad work <8> "half" <0> demi-god is the expr i believe
Return to
#sed or Go to some related
logs:
unbuntu install amule #qemu debian dsp no such deivce #python Cannot modify header information makeThumbnail postcat queue #centos #osdev set_app_type
#gentoo
|
|