LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2010, 10:11 AM   #16
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,960

Rep: Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703Reputation: 703

Hi,

seeing that
- your application is on bad terms with the perl-parser
- you do not have ruby
- your application might be very formatting sensitive , thus
- maybe also on bad terms with ruby

well, maybe you could use something simpler approach, like
Code:
$ cat file
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>

$ sed -r "/<TRANSFORMATION.*TYPE =\"Sequence\"/,/<\/TRANSFORMATION>/ {/TRANSFORMFIELD/ s/(DATATYPE[[:blank:]]*=[[:blank:]]*\")[^\"]*/\1INTEGER/}" file
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="INTEGER" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Expression">
<TRANSFORMFIELD DATATYPE ="bigint" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="INTEGER" PRECISION ="19"/>
</TRANSFORMATION>
<TRANSFORMATION DESCRIPTION ="" TYPE ="Sequence">
<TRANSFORMFIELD DATATYPE ="INTEGER" PRECISION ="19"/>
</TRANSFORMATION>
Maybe you do not need sed and you can use the regex with perl, not sure about that since I am not familiar with perl. I am also not sure if the '[[:blank:]]*' are needed or if some more are needed. Since you did not use [CODE][/CODE] tags to post your sample data there might be some formatting issues that went unnoticed.
If you need other tags changed you might have to exchange the keywords with variables.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl search and replace J_Szucs Programming 3 08-18-2010 03:51 AM
Using key to match against source.txt file to add xml tags to names in Perl ginny2010 Programming 3 06-22-2010 02:16 PM
search and replace text between tags pchoudhary Linux - Newbie 3 06-22-2009 02:14 PM
perl replace script for xml ruffles Programming 8 06-17-2008 06:30 PM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 02:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration