Computing.Net > Forums > Unix > Help with String Manipulation !

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help with String Manipulation !

Reply to Message Icon

Name: gauravsachan
Date: May 18, 2007 at 05:45:52 Pacific
OS: Sun 5.9
CPU/Ram: Intel
Product: SPARC
Comment:

Hi All,
I want to achive the following in many of my XML files
Before:
<Orig Dest ID>D A T A</Orig Dest ID>
After
<OrigDestID>D A T A</OrigDestID>
ie:
only the spaces in the tags are removed and not the Value/Data between the tags!!!


-regards
GS



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: May 18, 2007 at 08:53:08 Pacific
Reply:

[code]
awk ' BEGIN { RS="[<>]"; ORS="" }
/Orig/ { gsub(" ","",$0);
$0 = "<"$0">"
}
{print $0}
' "file"
[/code]


0

Response Number 2
Name: benitdhotekar
Date: May 29, 2007 at 05:52:09 Pacific
Reply:

Hi Ghostdog,

Can you plz explain what does RS and ORS stand for and how this code works?
where can i find the list of such commands.

Thanks
Benit


0

Response Number 3
Name: ghostdog
Date: May 29, 2007 at 08:43:32 Pacific
Reply:

RS=record separator, ORS=output record separator. you can google for GNU awk. Read the guide for GNU awk. Or you can read the man page for awk.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Help with String Manipulation !

String manipulation www.computing.net/answers/unix/string-manipulation/7391.html

Help with converting cases. www.computing.net/answers/unix/help-with-converting-cases/4761.html

working with strings www.computing.net/answers/unix/working-with-strings/6612.html