![]() |
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 |
| Unix Arithmatic operation issue , datatype issue | thambi | Shell Programming and Scripting | 23 | 02-19-2008 07:19 AM |
| specifing range.... | zedex | UNIX for Advanced & Expert Users | 1 | 10-19-2007 09:07 AM |
| Getting 'out of range' when partitioning | pmichner | UNIX for Dummies Questions & Answers | 1 | 09-30-2006 01:51 AM |
| Look a string within a range! | azmathshaikh | Shell Programming and Scripting | 0 | 05-01-2005 03:54 AM |
| Unix SCO 5.0.6 Out of range | josramon | UNIX for Dummies Questions & Answers | 5 | 02-21-2003 02:06 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Sed Range Issue
OK, so for a grand overview of what I'm trying to do:
I've got 2 files that are mostly like. The file format is: [descriptor1] data data data data [descriptor2] data data data data [descriptor3] data data [descriptor4] data data OK, so what I need to do is take all data from [descriptor2] and [descriptor3] sections from file1, remove like sections from file2, and then insert the stream from file1 in the right spot in file2. Fun, right? Well, I'm new w/ sed, but that seems the best way to do this (correct me if I'm wrong). I've got some code that's working atm, however it's giving me the actual line [descriptor4] as that's the end of the range I'm using and I don't want it to include that in the section delete, how do I not make it do that? sed '/\[descriptor2/,/\[descriptor4/!d' file1 Basically, I want the output to be: [descriptor2] data data data data [descriptor3] data data And it's giving me all that, plus a [descriptor4] as that's where the range ends, but I'm not sure how else to define it. Thank you for any light you can shed! |
|
||||
|
Code:
sed -e '/\[descriptor2/,/\[descriptor4/!d' -e '/\[descriptor4/d' file1 |
| Sponsored Links | ||
|
|