Sponsored Content
Top Forums Shell Programming and Scripting Find string in XML file, copy contents of section Post 302614199 by jrfiol on Wednesday 28th of March 2012 10:28:10 AM
Old 03-28-2012
Find string in XML file, copy contents of section

I am new, really new to bash scripts.

I want to search an XML file for a certain string, say "1234567890"

Once found, I want to copy the entire contents from the previous instance of the string "Entity" to the next instance of "/Entity" to a txt file.

And then continue searching for the string in the same file.

Thank you for any guidance,

jrfiol

Last edited by jrfiol; 03-28-2012 at 11:29 AM.. Reason: read it and felt it needed more
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find and copy string in a file

Hello there I need to find a string in an file, and then copy to a new file from the previous 6 lines to 41 lines after the string. So, what i need to do , and just don't know how, is to find the string and copy 48 lines where the string would be in the 7th line. I don't know if i can do it with... (10 Replies)
Discussion started by: vascobrito
10 Replies

2. UNIX for Dummies Questions & Answers

help find a section line of a file

hi, I have a 20 line file. I need a command which will brinf back a specific line based upon the line number I enter. e.g. the file looks like this and is called file1 jim is a man john is a woman james is a man wendy is a woman lesley is a woman i want a command that will... (4 Replies)
Discussion started by: sureshy
4 Replies

3. Shell Programming and Scripting

Copy selected contents from file

I want to capture contents of a file between 2 strings into another file for eg all lines in between the keywords "start log" and "end log" should be copied into another file (4 Replies)
Discussion started by: misenkiser
4 Replies

4. Shell Programming and Scripting

Copy contents of a directory only if a file exists

I'm looking to write a script that will check the contents of a directory, and if any files exist in that directory copy them to a temporary folder. The target files are only resident for a few seconds, so I think the script needs to be running constantly. Any pointers would be really... (3 Replies)
Discussion started by: danceofillusion
3 Replies

5. Shell Programming and Scripting

copy the contents between two keywords to a new file.

Hi All, I want to edit my gate level netlists by searching for the content between two patterns eg: ff1 \test/a0 ( .CLK(\test/ClkInt0_acb_00x1 ),.D(\test/Rakicc ), .QB(\test/X ), .VDD(1'b1), .VSS(1'b0)); ff1 \test/a1 ( .CLK(\test/medis0_acb_00x1 ),.D(\test/hedwc ), .QB(\test/X ),... (6 Replies)
Discussion started by: naveen@
6 Replies

6. Shell Programming and Scripting

Need help to copy contents of a file

Hi, I am stuck up with a problem of copying the contents of a directory where one of the folder name is changed daily. Problem: I have the folder structure as: RefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_build_xxx/.../.. In the above path the build number (xxx) will be changed... (3 Replies)
Discussion started by: SathaKarni
3 Replies

7. Shell Programming and Scripting

sed - String substitution within specified section in ini type file

Hello. I am trying to modify a config file which is in windows *.ini type file. I have found a piece of code here :linux - Edit file in unix using SED - Stack Overflow As I can't make it doing the job , I am trying to find a solution step by step. here a modified sample file : my_sample.ini... (1 Reply)
Discussion started by: jcdole
1 Replies

8. Shell Programming and Scripting

Copy contents of one file to another

I need to write a script (in bash) that copies the content of the first file in each folder of a directory to the second file in the same folder. I tried this and it didn't work - it just came back with errors and I'm not sure how to fix it. Help is very much appreciated! for mpdir in... (4 Replies)
Discussion started by: LeftoverStew
4 Replies

9. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

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)
Discussion started by: pchang
19 Replies

10. UNIX for Beginners Questions & Answers

Copy last 30 minutes' contents from a log file

Hi Guys, I am writing a bash script to capture the last 30 minutes's contents from log file to a new file. This job is a scheduled job and will run every 30 minutes. The log file is db2diag.log in DB2. I am having difficulties copying the last 30 minutes's contents. Can someone please help me.... (4 Replies)
Discussion started by: naveed
4 Replies
Mail::Message::Convert::MimeEntity(3pm) 		User Contributed Perl Documentation		   Mail::Message::Convert::MimeEntity(3pm)

NAME
Mail::Message::Convert::MimeEntity - translate Mail::Message to MIME::Entity vv INHERITANCE
Mail::Message::Convert::MimeEntity is a Mail::Message::Convert is a Mail::Reporter SYNOPSIS
use Mail::Message::Convert::MimeEntity; my $convert = Mail::Message::Convert::MimeEntity->new; my Mail::Message $msg = Mail::Message->new; my MIME::Entity $entity = $convert->export($msg); my MIME::Entity $entity = MIME::Entity->new; my Mail::Message $msg = $convert->from($entity); use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => 'Outbox'); $folder->addMessage($entity); DESCRIPTION
The MIME::Entity extends Mail::Internet message with multiparts and more methods. The Mail::Message objects are more flexible in how the message parts are stored, and uses separate header and body objects. Converters between message objects Other converters METHODS
Constructors Mail::Message::Convert::MimeEntity->new(OPTIONS) See "METHODS" in Mail::Message::Convert Converting $obj->export(MESSAGE, [PARSER]) Returns a new MIME::Entity message object based on the information from the MESSAGE, which is a Mail::Message object. You may want to supply your own PARSER, which is a MIME::Parser object, to change the parser flags. Without a PARSER object, one is created for you, with all the default settings. If "undef" is passed, in place of a MESSAGE, then an empty list is returned. When the parsing failes, then MIME::Parser throws an exception. example: my $convert = Mail::Message::Convert::MimeEntity->new; my Mail::Message $msg = Mail::Message->new; my manual MIME::Entity $copy = $convert->export($msg); $obj->from(MIME-OBJECT) Returns a new Mail::Message object based on the information from the specified MIME::Entity. If the conversion fails, the "undef" is returned. If "undef" is passed in place of an OBJECT, then an empty list is returned. example: my $convert = Mail::Message::Convert::MimeEntity->new; my MIME::Entity $msg = MIME::Entity->new; my Mail::Message $copy = $convert->from($msg); $obj->selectedFields(HEAD) See "Converting" in Mail::Message::Convert Error handling $obj->AUTOLOAD() See "Error handling" in Mail::Reporter $obj->addReport(OBJECT) See "Error handling" in Mail::Reporter $obj->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK]) Mail::Message::Convert::MimeEntity->defaultTrace([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK]) See "Error handling" in Mail::Reporter $obj->errors() See "Error handling" in Mail::Reporter $obj->log([LEVEL [,STRINGS]]) Mail::Message::Convert::MimeEntity->log([LEVEL [,STRINGS]]) See "Error handling" in Mail::Reporter $obj->logPriority(LEVEL) Mail::Message::Convert::MimeEntity->logPriority(LEVEL) See "Error handling" in Mail::Reporter $obj->logSettings() See "Error handling" in Mail::Reporter $obj->notImplemented() See "Error handling" in Mail::Reporter $obj->report([LEVEL]) See "Error handling" in Mail::Reporter $obj->reportAll([LEVEL]) See "Error handling" in Mail::Reporter $obj->trace([LEVEL]) See "Error handling" in Mail::Reporter $obj->warnings() See "Error handling" in Mail::Reporter Cleanup $obj->DESTROY() See "Cleanup" in Mail::Reporter $obj->inGlobalDestruction() See "Cleanup" in Mail::Reporter DIAGNOSTICS
Error: Converting from MIME::Entity but got a $type, return Error: Package $package does not implement $method. Fatal error: the specific package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/ LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-05-07 Mail::Message::Convert::MimeEntity(3pm)
All times are GMT -4. The time now is 12:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy