![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Delete line in text file | Berserk | UNIX for Dummies Questions & Answers | 6 | 12-16-2008 03:44 PM |
| How to delete a particular text without opening the file. | stevefox | Shell Programming and Scripting | 12 | 02-21-2008 01:24 PM |
| Overwrite & Delete in Text File | 33junaid | Shell Programming and Scripting | 11 | 08-16-2007 05:28 AM |
| Delete first line from any text file ? | aungomarin | Shell Programming and Scripting | 5 | 05-16-2006 09:42 PM |
| delete last line from text file | hcclnoodles | Shell Programming and Scripting | 4 | 06-25-2002 09:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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?? |
|
||||
|
thanks
however i need to put this in a script so i try to write this down:`sed -e 's_^.\{,2\}:.\{,2\}:.\{,2\} .*<pregate_<pregate_g' p.txt > sample.modified` however i get this msg : sed: command garbled: s_^.\{,2\}:.\{,2\}:.\{,2\} .*<pregate_<pregate_g sorry as im still new to scripting.... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|