| | |
Problem using sed
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 106
Reputation:
Solved Threads: 0
Hi,
I am trying to replace the old_string with the new_string using sed.
But i am unable to do it using the following script.
Contents of file1.txt
Any help is appreciated.
I am trying to replace the old_string with the new_string using sed.
But i am unable to do it using the following script.
Shell Scripting Syntax (Toggle Plain Text)
#!/bin/sh old_string="p cnf 10 20" new_string="p cnf 98 99" sed -e 's/old_string/new_string/' file1.txt > file2.txt
Contents of file1.txt
Shell Scripting Syntax (Toggle Plain Text)
p cnf 10 20 1 2 3 4 5 6 8 9 10 11 12 30
Any help is appreciated.
Last edited by guest7; Oct 17th, 2009 at 9:34 pm.
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#3 31 Days Ago
I have a little sed problem which I can't seem to figure out:
I would like to concatenate the next line of a file to the current line if the current line doesn't end in ;
I tried the next command but it doesn't seem to work:
sed '/[^;]$/{N;s/\n//;}'
Any ideas?
I would like to concatenate the next line of a file to the current line if the current line doesn't end in ;
I tried the next command but it doesn't seem to work:
sed '/[^;]$/{N;s/\n//;}'
Any ideas?
![]() |
Similar Threads
- script to find function names (Shell Scripting)
- Replace (Shell Scripting)
- sed leaves file empty (Shell Scripting)
- sed problem (Legacy and Other Languages)
- sendmail problem using cron (Shell Scripting)
- Replacing a large amount of text (Shell Scripting)
- help with shell script padding files with spaces (Shell Scripting)
- [Bash] problem with script in sed command (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: access time of a file in unix
- Next Thread: strange problem in parameter passing
Views: 990 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Shell Scripting






