LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-13-2005, 11:47 PM   #1
nano_mag
LQ Newbie
 
Registered: May 2005
Posts: 4

Rep: Reputation: 0
Post 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.
 
Old 05-15-2005, 10:36 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
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
 
Old 05-15-2005, 10:41 AM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Oh, a suggestion: Try a
Code:
hexdump -c xclt.sed
Perhaps you have some non-printing character in your file.
 
Old 05-15-2005, 08:51 PM   #4
nano_mag
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
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."
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed error message: extra characters after the command. nano_mag Linux - General 3 05-15-2005 02:00 AM
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-04-2005 12:00 AM
sed substitution error BlkPoohba Programming 1 08-25-2004 03:00 PM
sed error: "parentheses not balanced" - But they are! Travis86 Programming 2 08-12-2004 08:08 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM


All times are GMT -5. The time now is 08:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration