![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script works on Solaris, not on Linux | Silverhood | Shell Programming and Scripting | 1 | 10-05-2007 10:52 AM |
| Script works on Solaris, not on Linux | Silverhood | Shell Programming and Scripting | 0 | 10-05-2007 10:27 AM |
| Appending line ending with '}" to new line | aismann | Shell Programming and Scripting | 4 | 08-13-2007 03:09 AM |
| Appending the line number and a seperator to each line of a file ? | pjcwhite | Shell Programming and Scripting | 4 | 03-21-2007 01:29 AM |
| works from cmd-line but not in script | OFFSIHR | Shell Programming and Scripting | 4 | 10-18-2006 09:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Appending line with sed works on Linux but not on Solaris
Hi folks, Our application installation uses "sed" command to append string after specific line or after line number. Both cases work perfect on Linux but fail on Solaris. The OS versions are Solaris 9 and Linux Red Hat AS 3. i.g: Linux: ----- file foo.txt Code:
aaa bbb ccc ddd Code:
root# uname -s Linux root# sed '2a\Add this line after line 2\' foo.txt aaa bbb Add this line after line 2 ccc ddd Code:
root# sed '/bbb/ a\Add this line after bbb' foo.txt aaa bbb Add this line after bbb ccc ddd Sun Solaris ----------- Code:
root# uname -s SunOS root# sed '/bbb/ a\Add this line after bbb' foo.txt sed: command garbled: /bbb/ a\Add this line after bbb Code:
root# sed '2a\Add this line after line 2\' foo.txt aaa bbb ccc ddd As you can see,sed works fine on Linux but not on Solaris. Is there a different in sed syntax between platforms? Thanks in advance, Nir |
|
||||
|
Hi aigles, Thanks for your reply. Both suggestions failed: Code:
root# sed '2a\Add this line after line 2' foo.txt sed: command garbled: 2a\Add this line after line 2 root# sed '2a\^JAdd this line after line 2' foo.txt sed: command garbled: 2a\^JAdd this line after line 2 Any other suggestions? Thanks in advance, Nir |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|