LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sed -f: error (https://www.linuxquestions.org/questions/linux-newbie-8/sed-f-error-323314/)

nano_mag 05-13-2005 10:47 PM

sed -f: error
 
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.

PTrenholme 05-15-2005 09:36 AM

That code seems to work OK for me. Here's my version:
Code:

$ cat tmp/test.sed
s/NRVALM=[[:digit:]]+/NRVALM=100000/g
s/NRVALX=[[:digit:]]+/NRVALX=95000/g
s/ICDM=[[:digit:]]+/ICDM=20000/g
s/NVARM=[[:digit:]]+/NVARM=1000/g
s/NCNSM=[[:digit:]]+/NCNSM=5000/g
s/NFNCM=[[:digit:]]+/NFNCM=100/g
s/NSYS=[[:digit:]]+/NSYS=2000/g
/^>+START MAIN/,/^>+END MAIN/d
/^>+START IOFNC/,/^>+END IOFNC/d
/^>+START EXFNC/,/^>+END EXFNC/d

and my results: (stdout in bold)
Code:

$ sed -rf tmp/test.sed
ICDM=1234
ICDM=20000
NSYS=4
NSYS=2000
>>>START MAIN
1
2
3
>>>END MAIN
NSYS=4
NSYS=2000


PTrenholme 05-15-2005 09:41 AM

Oh, a suggestion: Try a
Code:

hexdump -c xclt.sed
Perhaps you have some non-printing character in your file.

nano_mag 05-15-2005 07:51 PM

Thank you very much!
Somebody has told me a solution:"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."


All times are GMT -5. The time now is 06:29 AM.