Sponsored Content
Top Forums Shell Programming and Scripting how to delete away text in a file? Post 95058 by forevercalz on Friday 6th of January 2006 05:01:27 AM
Old 01-06-2006
how to delete away text in a file?

I have this xml file which is call p.txt and it contains the follwing:
16:13:56 Msg send to Queue=[<pregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<system_c>HPREGATE</system_c>
<trans_c>HSPG</trans_c>
<trans_dt>20060105161333</trans_dt>
<user_id_m></user_id_m>
<func_c>C</func_c>
<pm_n>XA 4650H</pm_n>
<chassis_type>20</chassis_type>
<chassis_ulw>00000</chassis_ulw>
<pager_n>90000000</pager_n>
<pager_mode>M</pager_mode>
<source_c>P</source_c>
<import>
<purp_i>D</purp_i>
<cntr_n>KKTU 7247736 </cntr_n>
<gway_to>T</gway_to>
<dvr_pass_n> </dvr_pass_n>
<hlr_creg_n>12267750000M</hlr_creg_n>
<nmt_n> </nmt_n>
<new_cntr_n> </new_cntr_n>
<new_nmt_n> </new_nmt_n>
<gate_n></gate_n>
<mpt_i> </mpt_i>
</import>
</pregate>
16:33:36 Sending Message :<pregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<system_c>HPREGATE</system_c>
<trans_c>HSPG</trans_c>
<trans_dt>20060105163319</trans_dt>
<user_id_m></user_id_m>
<func_c>C</func_c>
<pm_n>XA 7359E</pm_n>
<chassis_type>20</chassis_type>
<chassis_ulw>00000</chassis_ulw>
<pager_n>94939929</pager_n>
<pager_mode>M</pager_mode>
<source_c>P</source_c>
<export>
<purp_i>S</purp_i>
<cntr_n>CRLU 5129584 </cntr_n>
<tt_i> </tt_i>
<new_cntr_n> </new_cntr_n>
<gway_to>T</gway_to>
<old_nmt_n> </old_nmt_n>
<kd_i>Y</kd_i>
<gate_n>5</gate_n>
<mpt_i>N</mpt_i>
<hlr_creg_n>12267750000M</hlr_creg_n>
<tt_frm_dt> </tt_frm_dt>
<tt_to_dt> </tt_to_dt>
</export>
</pregate>

as you can see the bold text are the one that i need to delete away and there are alot more xml set of data in the p.txt. so any ideas how to delete away the data??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete last line from text file

I have a file with which i must remove the last line of the file (the footer). I know how to copy and redirect with tail -1 etc, but how do i delete it permanentely (4 Replies)
Discussion started by: hcclnoodles
4 Replies

2. Shell Programming and Scripting

Delete first line from any text file ?

What command I can use to delete first line from any text file ? Thk (5 Replies)
Discussion started by: aungomarin
5 Replies

3. Shell Programming and Scripting

How to delete a particular text without opening the file.

Hi, Could someone tell me how to delete a particular text inside an existing file without opening the file? e.g. I have a text file called mytext.txt which contains three lines of text below and I want to delete “ ;” and delete the second line “b ;” including the carriage return. a ; b ; c ;... (12 Replies)
Discussion started by: stevefox
12 Replies

4. UNIX for Dummies Questions & Answers

Delete line in text file

Hi, How do I go about deleting a line in a text file. I have used grep to find a particlular word, now how do I delete the line? so far I got: grep -i $keyword file.txt (6 Replies)
Discussion started by: Berserk
6 Replies

5. Shell Programming and Scripting

Delete block of text in one file based on list in another file

Hi all I currently use the following in shell. #!/bin/sh while read LINE do perl -i -ne "$/ = ''; print if !m'Using archive: ${LINE}'ms;" "datafile" done < "listfile" NOTE the single quote delimiters in the expression. It's highly likely the 'LINE' may very well have characters in it... (3 Replies)
Discussion started by: Festus Hagen
3 Replies

6. UNIX for Dummies Questions & Answers

How to delete one line from a text file

PATTERN="" sed "/$PATTERN/d" $file In the file data is stored as ::: ::: I need to delete only the line containing the PATTERN pls help to point out why the above code is not working (4 Replies)
Discussion started by: thomsandy
4 Replies

7. Shell Programming and Scripting

How to delete lines from text file?

hi guys, I have very large txt files (200GB) and just want to to delete the first two lines (headers). So far I used sed -i '1,2d' infile.txtbut this command always takes extremely long as it writes all again. Is there a better way to do it (ie just to delete the lines without writing all... (2 Replies)
Discussion started by: TuAd
2 Replies

8. Shell Programming and Scripting

delete text from each record in a file

Hi guys, I have been given a small task to do and I am stuck already. I have to format a file with people's emails address in it ready for pasting into the BCC section of an email. The file looks like this:- bob@ibm.com SMTP BOB SMITH text text text sue@icl.org SMTP Susy Smith text text... (8 Replies)
Discussion started by: joe_evans
8 Replies

9. Shell Programming and Scripting

How to delete lines of a text file based on another text file?

I have 2 TXT files with with 8 columns in them(tab separated). First file has 2000 entries whereas 2nd file has 300 entries. The first file has ALL the lines of second file. Now I need to remove those 300 lines (which are in both files) from first file so that first file's line count become... (2 Replies)
Discussion started by: prvnrk
2 Replies

10. UNIX for Dummies Questions & Answers

Delete records based on a text file from a text file

Hi Folks, I am a novice and need to build a script in bash. I have 2 text files data.txt file is big file, column 2 is the we need to search and delete in the output. The filter file contains the rows to be deleted. Data.txt state city zone Alabama Huntsville 4 California SanDiego 3... (3 Replies)
Discussion started by: tech_frk
3 Replies
Net::EPP::Frame::Command::Delete::Domain(3pm)		User Contributed Perl Documentation	     Net::EPP::Frame::Command::Delete::Domain(3pm)

NAME
Net::EPP::Frame::Command::Delete::Domain - an instance of Net::EPP::Frame::Command::Delete for domain names. SYNOPSIS
use Net::EPP::Frame::Command::Delete::Domain; use strict; my $delete = Net::EPP::Frame::Command::Delete::Domain->new; $delete->setDomain('example.tld'); print $delete->toString(1); This results in an XML document like this: <?xml version="1.0" encoding="UTF-8"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd"> <command> <delete> <domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> <domain:name>example.tldE<lt>/domain:name> </domain:delete> </delete> <clTRID>0cf1b8f7e14547d26f03b7641660c641d9e79f45</clTRIDE<gt> </command> </epp> OBJECT HIERARCHY
L<XML::LibXML::Node> +----L<XML::LibXML::Document> +----L<Net::EPP::Frame> +----L<Net::EPP::Frame::Command> +----L<Net::EPP::Frame::Command::Delete> +----L<Net::EPP::Frame::Command::Delete::Domain> METHODS
$frame->setDomain($domain_name); This specifies the domain name to be deleted. AUTHOR
CentralNic Ltd (http://www.centralnic.com/). COPYRIGHT
This module is (c) 2012 CentralNic Ltd. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
o Net::EPP::Frame perl v5.14.2 2012-04-23 Net::EPP::Frame::Command::Delete::Domain(3pm)
All times are GMT -4. The time now is 10:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy