LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   sed error message: extra characters after the command. (http://www.linuxquestions.org/questions/linux-general-1/sed-error-message-extra-characters-after-the-command-323353/)

nano_mag 05-14-2005 01:54 AM

sed error message: extra characters after the command.
 
Dear Sir,
I am a newbie. I got the following message:
sed -f xclt.sed file1.f > file2.f
sed: xclt.sed line 8: extra characters after command
My xclt.sed file is as follows:
s/NRVALM=[0-9][0-9]*/NRVALM=100000/g
s/NRVALX=[0-9][0-9]*/NRVALX=95000/g
s/ICDM=[0-9][0-9]*/ICDM=20000/g
s/NVARM=[0-9][0-9]*/NVARM=1000/g
s/NCNSM=[0-9][0-9]*/NCNSM=5000/g
s/NFNCM=[0-9][0-9]*/NFNCM=100/g
s/NSYS=[0-9][0-9]*/NSYS=2000/g
/>>>START MAIN/,/>>>END MAIN/d
#/>>>START SUBSYSTEM/,/>>>END SUBSYSTEM/d
/>>>START IOFNC/,/>>>END IOFNC/d
/>>>START EXFNC/,/>>>END EXFNC/d

note: there is no error when I do the same job in unix system.

Could you please tell me a solution?
With best wishes.

mschutte 05-14-2005 03:23 AM

Probably because of the hash sign `#' at the beginning of line 9?

jschiwal 05-14-2005 11:01 PM

from the sed info page:
Quote:

Often-Used Commands
===================

If you use `sed' at all, you will quite likely want to know these
commands.

`#'
[No addresses allowed.]

The `#' character begins a comment; the comment continues until
the next newline.

If you are concerned about portability, be aware that some
implementations of `sed' (which are not POSIX conformant) may only
support a single one-line comment, and then only when the very
first character of the script is a `#'.
I'm not sure what is meant by "[no address allowed]"
Perhaps if you added a space after the octothorpe character on line 9.

I copied and pasted your xclt.sed file and tried it out on a sample file which included
>>>START MAIN
#... more lines here.

>>>END MAIN

The program removed this range of lines without errors for me.
You might try deleting and re-entering line 8 in your script, in case there is a hidden white-space character at the end of line in your xclt.sed script.

nano_mag 05-15-2005 01:00 AM

Thank you very much for your help. You are great!

The reason is :"You might try deleting and re-entering line 8 in your script, in case there is a hidden white-space character at the end of line in your xclt.sed script."

This "simple" miss wastes me too much time.

Thank you very much again.


All times are GMT -5. The time now is 06:37 PM.