Prev: Want to insert some stuff as a new line after the line matchingregexp.
Next: Bulk moving of files
From: Seebs on 23 Mar 2010 13:10 On 2010-03-23, moonhkt <moonhkt(a)gmail.com> wrote: > I tried to handle those Metacharacters this morning, but failure to > handle those character. That's nice. Tell you what. You demonstrate to me that you've read ESR's "how to ask questions", and that you comprehend it, and I'll answer your question. Otherwise, please stop wasting everyone's time by refusing to even think. Hint: "failure to handle" is uninformative. We don't know what you tried, or how it failed, or even why you think what happened was a failure. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: moonhkt on 24 Mar 2010 04:12 On 3æ24æ¥, ä¸å1æ10å, Seebs <usenet-nos...(a)seebs.net> wrote: > On 2010-03-23, moonhkt <moon...(a)gmail.com> wrote: > > > I tried to handle those Metacharacters this morning, but failure to > > handle those character. > > That's nice. > > Tell you what. > > You demonstrate to me that you've read ESR's "how to ask questions", and > that you comprehend it, and I'll answer your question. > > Otherwise, please stop wasting everyone's time by refusing to even think. > > Hint:  "failure to handle" is uninformative.  We don't know what you tried, > or how it failed, or even why you think what happened was a failure. > > -s > -- > Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nos...(a)seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! Try This morning . OK #!/bin/ksh # 2010/03/22 hostname=`hostname` case "$hostname" in phxdev2|phxdev3|phxdev4|phxdev5 ) ;; *) echo "This script for phxdev2,3,4 and 5 only " exit ;; esac FN=/phx/src/testing_email_body.txt SER_LINE='\/\* testing_email_body.txt \*\/' REP_LINE='UNIX SILENT cat /phx/src/testing_email_body.txt > VALUE(tmp- file1).' #SER_LINE='mail' #REP_LINE='kk' echo "This email is sent from phx Development Server ("$hostname"). Please ignore this testing email. Thanks ! " > "$FN" # Change Program echo Search "$SER_LINE" echo Replace "$REP_LINE" echo file sed "s:${SER_LINE}:${REP_LINE}:g" abc.p > a.txt #sed 's/mail/kk/g' abc.p
From: Maxwell Lol on 24 Mar 2010 07:39 moonhkt <moonhkt(a)gmail.com> writes: > > Try This morning . OK > > #!/bin/ksh > # 2010/03/22 > > hostname=`hostname` > > case "$hostname" in > phxdev2|phxdev3|phxdev4|phxdev5 ) ;; > *) echo "This script for phxdev2,3,4 and 5 only " > exit ;; > esac Why did you include this part? It is obvious that it has nothing to do with the problem, and than if we keep it in, the script WILL NOT WORK! > FN=/phx/src/testing_email_body.txt And this file DOES NOT EWXIST! > SER_LINE='\/\* testing_email_body.txt \*\/' > REP_LINE='UNIX SILENT cat /phx/src/testing_email_body.txt > VALUE(tmp- > file1).' > #SER_LINE='mail' > #REP_LINE='kk' > echo "This email is sent from phx Development Server ("$hostname"). > Please ignore this testing email. Thanks ! > " > "$FN" > And this has nothing to do with your problem > # Change Program > echo Search "$SER_LINE" > echo Replace "$REP_LINE" > echo file > sed "s:${SER_LINE}:${REP_LINE}:g" abc.p > a.txt > #sed 's/mail/kk/g' abc.p Where is file abc.p? We help because we want to. And many of us are very busy, just like you are. You are being inconsiderate and lazy. You should be ashamed of your actions for posting such terrible examples. Now here is an example of hat you should have posted. #!/bin/ksh SER_LINE='\/\* testing_email_body.txt \*\/' REP_LINE='UNIX SILENT cat /phx/src/testing_email_body.txt > VALUE(tmp-file1).' echo '/* testing_email_body.txt */'| sed "s:${SER_LINE}:${REP_LINE}:g" --------------------- and that works fine. When I run the script, using bash I get UNIX SILENT cat /phx/src/testing_email_body.txt > VALUE(tmp-file1). whis is as far as I can tell, what you want to get.
From: Seebs on 24 Mar 2010 18:31 On 2010-03-24, moonhkt <moonhkt(a)gmail.com> wrote: > On 3?24?, ??1?10?, Seebs <usenet-nos...(a)seebs.net> wrote: >> You demonstrate to me that you've read ESR's "how to ask questions", and >> that you comprehend it, and I'll answer your question. >> Hint: �"failure to handle" is uninformative. �We don't know what you tried, >> or how it failed, or even why you think what happened was a failure. > Try This morning . OK Not even close. Read the above. Again. You need to say: 1. What you were trying to do. 2. What you wanted it to do. 3. What actually happened. 4. Why you think this is a problem. You have told us NONE of the above, you've just handed us a hunk of code. The code has no explanation of what the intended behavior is, and has commented-out bits suggesting that it's not really very well understood. Here, let me show you what an actual question would look like: I have the following input file: kitty I would like to process this and create a file like this: puppy Here is my first attempt. When I run this, instead of creating a file which contains the word "puppy", it creates a file which reads "idiot". What should I change to do that? #!/bin/sh sed -e 's/kitty/idiot/' < input > output Note how I clearly state what I have as input, giving an explicit and exact example of it, not a vague handwaving description. Note how I also clearly show what the output would look like. I also explain what I actually get when I run my script. It would be very easy for someone to answer this question, because I've given the reader enough information to do something with it. You haven't. Furthermore, I've explained more than once what you need to do in order to get better answers, and you've ignored it. You get one more try before I give up, killfile you, and stop trying to help. I'm glad to help people who are willing to make a reasonable effort to explain what they need help with. If you're not willing to give me enough information to make it *possible* for me to help you (because I still have no idea what your problem is), then it's not worth it for me to spend time guessing wildly. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: moonhkt on 25 Mar 2010 00:51 On 3æ25æ¥, ä¸å6æ31å, Seebs <usenet-nos...(a)seebs.net> wrote: > On 2010-03-24, moonhkt <moon...(a)gmail.com> wrote: > > > On 3?24?, ??1?10?, Seebs <usenet-nos...(a)seebs.net> wrote: > >> You demonstrate to me that you've read ESR's "how to ask questions", and > >> that you comprehend it, and I'll answer your question. > >> Hint:  "failure to handle" is uninformative.  We don't know what you tried, > >> or how it failed, or even why you think what happened was a failure. > > Try This morning . OK > > Not even close. > > Read the above.  Again. > > You need to say: > 1.  What you were trying to do. > 2.  What you wanted it to do. > 3.  What actually happened. > 4.  Why you think this is a problem. > > You have told us NONE of the above, you've just handed us a hunk of > code.  The code has no explanation of what the intended behavior is, > and has commented-out bits suggesting that it's not really very well > understood. > > Here, let me show you what an actual question would look like: > >     I have the following input file: >         kitty >     I would like to process this and create a file like this: >         puppy >     Here is my first attempt.  When I run this, instead of >     creating a file which contains the word "puppy", it creates >     a file which reads "idiot".  What should I change to do that? > >     #!/bin/sh >     sed -e 's/kitty/idiot/' < input > output > > Note how I clearly state what I have as input, giving an explicit and exact > example of it, not a vague handwaving description.  Note how I also clearly > show what the output would look like.  I also explain what I actually get > when I run my script. > > It would be very easy for someone to answer this question, because I've given > the reader enough information to do something with it. > > You haven't.  Furthermore, I've explained more than once what you need to > do in order to get better answers, and you've ignored it. > > You get one more try before I give up, killfile you, and stop trying to help. > I'm glad to help people who are willing to make a reasonable effort to explain > what they need help with.  If you're not willing to give me enough information > to make it *possible* for me to help you (because I still have no idea what > your problem is), then it's not worth it for me to spend time guessing wildly. > > -s > -- > Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nos...(a)seebs.nethttp://www.seebs.net/log/<-- lawsuits, religion, and funny pictureshttp://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! Thank for your suggestion. Keep the coding sample and provide more information . I am not lazy. I try and search before post. May be I am not a good script writter.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Want to insert some stuff as a new line after the line matchingregexp. Next: Bulk moving of files |