![]() |
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 |
| moving apache part 2 | marinob007 | UNIX for Dummies Questions & Answers | 12 | 12-21-2007 03:11 PM |
| sh: Inserting tabs and moving text to 1 line | 00000008 | Shell Programming and Scripting | 6 | 07-26-2007 05:58 AM |
| Moving Part of a field to another field using AWK | rjsha1 | Shell Programming and Scripting | 5 | 08-04-2006 06:39 AM |
| moving a file? | Holistic | UNIX for Dummies Questions & Answers | 1 | 02-20-2003 07:47 PM |
| grep multiple text files in folder into 1 text file? | coppertone | UNIX for Dummies Questions & Answers | 7 | 08-23-2002 03:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Moving part of Text in a file
Hi,
I have this text in a file where I need to move part of the text.... <Relation1 OriginatingObjectID="Holding_1" RelatedObjectID="Party_1" id="Relation_1"> <OriginatingObjectType tc="4">Holding</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="32">Insured</RelationRoleCode> </Relation1> <Relation2 OriginatingObjectID="Holding_2" RelatedObjectID="Party_2" id="Relation_2"> <OriginatingObjectType tc="4">Holding</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="32">Insured</RelationRoleCode> </Relation2> I want only the first line of each block in this text to be modified to <Relation1 id="Relation_1" OriginatingObjectID="Holding_1" RelatedObjectID="Party_1"> similarly for second block .. <Relation1 id="Relation_2" OriginatingObjectID="Holding_2" RelatedObjectID="Party_2"> and so on.... I tried it this way but could not get the complete solution... grep "Relation1 " New_Text.txt | awk '{ print "<Relation " $4" "$2" "$3">"}' but The result is .. <Relation id="Relation_1"> OriginatingObjectID="Holding_1" RelatedObjectID="Party_1"> I do not want "id="Relation_1"> " instead I want id="Relation_1" This ">"should not appear after "Relation_1"...and how do I implement it in a text file where I have many blocks to be modified...and also have other blocks which does not need any change..? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|