|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
sed to replace specific positions on line with file contents
Hi, I am trying to use an awk command to replace specific character positions on a line beginning with 80 with contents of another file.
The line beginning with 80 in file1 is as follows: Quote:
The command i am using is: Quote:
Quote:
Quote:
|
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
I hope you have code to store the contents of file "amended_file_01" into variable "amended_file01"; after which a minor adjustment to your sed one-liner should do the trick: Code:
sed "/^80/s/\(^.\{34\}\).\{15\}\(.*\)/\1$amended_file01\2/" file1 |
| The Following User Says Thank You to balajesuri For This Useful Post: | ||
nwalsh88 (02-22-2013) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Hi balajesuri,
That's perfect, thanks for your help |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replace specific field on specific line sed or awk | crownedzero | Shell Programming and Scripting | 14 | 11-27-2011 03:34 PM |
| How to replace specific contents in a file? | Emilywu | Shell Programming and Scripting | 4 | 02-14-2011 06:50 PM |
| awk script replace positions if certain positions equal prescribed value | halplessProblem | Shell Programming and Scripting | 9 | 09-15-2010 10:35 AM |
| Need specific byte positions of a file | rmv | Shell Programming and Scripting | 6 | 10-13-2009 06:31 AM |
| using sed to replace a specific string on a specific line number using variables | todd.cutting | Shell Programming and Scripting | 2 | 08-13-2009 09:40 PM |
|
|