![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Convert Variable file to fixed file. | abhi9845 | Shell Programming and Scripting | 9 | 09-24-2008 09:07 AM |
| Convert Variable file to fixed file. | abhi9845 | UNIX for Dummies Questions & Answers | 1 | 09-15-2008 08:07 AM |
| variable in dos batch file | chssastry | Windows & DOS: Issues & Discussions | 6 | 08-29-2008 03:38 AM |
| variable into file | pppswing | Shell Programming and Scripting | 2 | 07-02-2008 05:55 AM |
| how to attach a variable from the 2nd file to the 1st file | lo tan | Shell Programming and Scripting | 5 | 06-03-2008 03:58 AM |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
sed -i '7 c\$variable' file ....(?!@#$%^&*!)
I have tried everything I can think of to get sed to change line N of a file to the contents of a variable. I have Googled the Internet, and I find lots of people telling how to use variables with the "Substitute" command, but no one telling how to use variables with the "Change" command.
I have considered the possibility of using the "Substitute" command with a wild card for existing text, but my search of the Internet tells me SED doesn't have wild cards in its repertoire, so it's difficult! There must be a better way. As I noted in the subject, the basic form I used is (where N is a line number): Code:
sed -i 'N c\$variable' FILE Thanks! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|