I am struggling with many huge XML files with lots of Account details including at least one Membership tag, in that Membership tag one xml tag was missed that is MembershipIdentifier:
(There are many Account tags with at least one Membership tag are there in each file)
but some how MembershipIdentifier tag is compleatly missing. After missing its look like below:
How can i find which AccountIdentifier missed MembershipIdentifier and if possible i need to replace with default MembershipIdentifier like PB00000000123456
So far i have tried with this for finding missed MembershipIdentifiers, but it didn't work:
Can somebody help me?
Thanks in advance...
Last edited by VasuKukkapalli; 11-30-2015 at 07:06 PM..
As i am dealing with large files(each file contains more that 10K Accounts and file count is more than 1000), this script just appending MI tag and displaying the output on the screen but not to the actual files, i am not sure how to add to actual files.
Also i would need to know which file and which AccountIdentifier(At least file name) missed MembershipIdentifier tag.
Could you please help me to get this done?
Thank in advance...
Making the wild assumption that the exec family of functions on your system can handle more than 1000 filenames in an argument list, the following should do what you want:
Call this script with a list of files to be processed as operands. If your system can't handle an arg list that long, use xargs to invoke this script multiple times with subsets of the argument list.
This was written and tested using the Korn shell, but will work with any shell that understands basic POSIX shell parameter expansions (including ash, bash, dash, ksh, and zsh) but will not work with a legacy Bourne shell and will not work with shells based on csh syntax.
And, as always, if you want to try this on a Solaris system, change awk to /usr/xpg4/bin/awk or nawk.
This User Gave Thanks to Don Cragun For This Post:
This snippet saves any .xml file as .xml.rebuilt and it adds a default MembershipIndentifier. It logs the details in a file named rebuilt.log in the current directory, reporting the file name, the line number and the account missing the tag. Updates will be printed to your screen.
Save as VasuKukkapalli.pl and run as perl VasuKukkapalli.pl file1.xml file2.xml file3.xml ...
or perl VasuKukkapalli.pl *.xml
The file rebuilt.log will have something similar to:
I want to write a one line script that outputs the result of multiple xml tags from a XML file. For example I have a XML file which has below XML tags in the file:
<EMAIL>***</EMAIL>
<CUSTOMER_ID>****</CUSTOMER_ID>
<BRANDID>***</BRANDID>
Now I want to grep the values of all these specified... (1 Reply)
Hi Forum.
I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script.
Any feedback will be greatly appreciated.
... (19 Replies)
hi,
I am still a newbie on ssh but trying hard.
my friends website was hit by some virus which included a long encrypted malware code on each and every php file she had.
I was able to use sed command via ssh to remove the malware codes but now most pages don't have a opening <?php tag.
i... (8 Replies)
I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help
File:
<xml><object1>house</object1><object2>child</object2>... (9 Replies)
As per the requirement I need to replace XML tag with old to new on one of the XML file.
Old<com : DEM>PHI</com : DEM>
New<com : DEM>PHM</com : DEM>
Please someone provide the sed command to replace above mentioned old XML tag with new XML tag (2 Replies)
Hi Guys
Here is my Input :
<?xml version="1.0" encoding="UTF-8"?>
<xn:MeContext id="01736">
<xn:VsDataContainer id="01736">
<xn:attributes>
<xn:vsDataType>vsDataMeContext</xn:vsDataType>
... (12 Replies)
Hi All,
I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me.
<A>testing_Location</A>
<value>LA</value>
<zone>US</zone>
<B>Region</B>
<value>Russia</value>
<zone>Washington</zone>
<C>Country</C>... (0 Replies)
Hi All,
Find the following code:
<Universal>D38x82j1JJ
</Universal>
I want to retrieve the value of <Universal> tag as below:
Please help me. (3 Replies)
We have 2 XML file 1. ORIGINAL.xml file and 2. ATTRIBUTE.xml files, In the ORIGINAL.xml we need some modification as <resourceCode>431048</resourceCode>under <item type="Manufactured"> tag - we need to grab the 431048 value from tag and pass it to database table in unix shell script to find the... (0 Replies)
Sorry to trouble you guys again.....but i encounter this problem:
My textfile contains this:
2006-01-12 01:12:08,290 INFO - The XML message **************<PM_ARRIVAL xmlns:xsi=
"http://www.w3.org/2001/XMLSchemainstance"><system_c>GMS</system_c><trans_c>ARLC</trans_c></<PM_ARRIVAL>
2006-01-12... (8 Replies)