| |
| |
| |
|
Comments:
<0> How can I do a text incase sensative match .. .I thought it was like sed 'i/something/ah/g' <1> hi, <1> anyone know how i could use sed and write the output in the soruce file? <2> sed -i 'commands' file <3> mv FILE FILE.new; sed ..... FILE.new >FILE; rm -f FILE.new <3> (which does the very same, GNU's -i does) <1> ThBonsai, the pblem there is a lot of file and there are not in the same directory <3> labreche: that's a problem of your shell, not of sed. you can't run sed recursively or similar. with or without -i <3> both methods are equal. HOW sed gets its file arguments (or in the mv-case, how the loop around that gets its file arguments) is a question of your script/code/commands <1> ok guys, tnx <1> sed -i is the simpliest awy to do what i want <1> TheBonsai, as i'm not really good with bash script, it will cost me too much time to make this script <1> but i 'll try <3> find <whatever> -exec <whatever> \; ?
<1> ThBonsais: for the recursive exec of sed -i, you got it: find -iname *.php|wargs sed -i command <3> you mean xargs, and you can write find -exec sed -i {} + <3> and you want to quote your pattern <3> i mean: find -iname "*.php" -exec sed -i {} + should do it aswell (if your find doesn't lack the standard) <3> regarding the + i mean <1> Hi gnubin <1> Hi gnubie <1> Hi gnubien <4> lol. <1> i'm not well waed up ;-) <5> labreche: hi <4> labreche: use tab completion ! <1> tnx goldfish <5> the tab is your easy typing spell checker best friend ;) <4> :) <6> is there a way to remove characters like <>#"/ in a text file? <3> yes <6> k <6> but how <6> cant get the job done <4> Why not <4> use the 's' command <3> i wouldn't use sed 's/<>#"\///g' for that, i'd use tr -d '<>#"/' <6> i got bad flag in substitute command <4> use tr. <4> as TheBonsai showed. <6> k <6> tr -d '<>#"/' < file does not work, i want to remove a exact line <>#"/ <4> hmmm? <4> You stated you wanted to remove those chars in a file. <4> sed '/^<>#"\/$/d' <6> k <6> i got invalid command code <4> paste it <6> goldfish, <>#"/ is just a example but the real line that must be remove a xx time in that html file is different ill past it .. <4> ah jesus <4> !!!! <6> it is extualy a hole block of html code that must be removed several times <4> ok <4> pastebin the file <6> www.pastebin.be/1787/ <4> and what do you want removed? <6> line 2 <6> and those two section buttons <4> hm. <6> well exualy that table it is a ugly one <6> i it possible? <6> i/is <6> line for line is allso okay <4> Well. <4> For that particular piece of text, sed '/^<td><font.*$/d;/<a.*$/d' , could work. <4> but it's not a very good solution....
<6> hmm, but it could allso remove lines that dont must be removed? <4> exactly <6> could tr do the job <4> nope <4> you could do it in sed <4> if you had the full file , you could hack up a sed command to do it <6> what characters must be given to isolate line 2 for example <4> the ones i gave are fine <4> for that sample text <4> it depends on what other <td> lines are in the file <6> i could allso give in your example the complete exact line 2 including spaces ? <4> you could <6> k <4> you wil have to escape / <4> so replace each / with \/ <6> in that line, ok <6> it does not work goldfish <4> sed '/<td><font color="black" size=1>I l<font color="#FF0000">@<\/font>ve RuBoard<\/td>/d' <4> works for me <6> you are right! it works thanks ;) <4> np. <6> am wondering if it is possible without using \ for / and isolate the string and command sed to see the line litterly as exact line of characters? <4> well <4> usually you can use a different delimiter for sed <4> i.e insstead of s/// <4> you can use s@@@ <4> or whatever <4> it appears not to be the case with my sed , for the //d command <4> so you will have to replace any / with \/ (i.e "escape it") <6> i see <6> so you can use s@@@ but not with combination with the delete command? <4> well <4> it appears you have to use //d <4> [%] sed '@a@d' a <4> sed: -e expression #1, char 1: unknown command: `@' <3> \@ <4> hmm. <4> TheBonsai: thanks. <4> klauwhamer: sed '\@blahblahblahblha@d' <4> or whatever delimiter you want to use. <6> hmm <6> cool <6> but it cannot handle <> <3> define "handle" <3> \> and \< are word boundaries in some RE dialects. maybe that's where you collide with it <6> so i dont get rit of that \ <3> ? <3> /foo/ in general is no RE, it's a line address <6> thebonsai, i mean if i use a exact string including some special characters like <> / " # , can i use that string without having to use these \ in that string? <3> when \< is special, < is literal <3> when * is special, \* is literal <3> easy princip <3> just don't let your shell eat some \\\\\ <3> use single quoting wherever you can <6> so with single quonting i can isolate a string literal? <3> completely literal, yes (POSIX shells, all bourne shells) <3> the only recognized character is (the closing) ' <3> that also explains why you need a thing like 'foo'\''s bar' to get: foo's bar <3> because the \ doesn't work inside '', no way to do 'foo\'s bar' <6> interresting <6> cool <6> thanks
Return to
#sed or Go to some related
logs:
povaddict debian -site:boincstats.com #css #linux xmms goodnight halt ion3 on centos install f4l suse 10.1 #lisp #web #ubuntu /INCREMENTAL:NO + mozilla
|
|