Sponsored Content
Top Forums UNIX for Dummies Questions & Answers replace characters with spaces between tag Post 302420940 by varunrbs on Thursday 13th of May 2010 02:21:34 AM
Old 05-13-2010
replace characters with spaces between tag

I have a file where in some records are having the <Start> and <End> tag. There is data before the start tag , between the tages and after the End tag. I want to replace everything between the start & end tag with equivalent spaces.

Input File

Code:
afsdfaksddfs<start>12678<end>sgdfgdfsf
afsdfaksddfs<start>4678<end>sgdfgdfsf
afsdfaksddfs<start>123678<end>sgdfgdfsf
afsdfaksddfs<start>12345678asdf<end>sgdfgdfsf

Output File

Code:
afsdfaksddfs<start>     <end>sgdfgdfsf
afsdfaksddfs<start>    <end>sgdfgdfsf
afsdfaksddfs<start>      <end>sgdfgdfsf
afsdfaksddfs<start>            <end>sgdfgdfsf

Thanks in advance for the help.

Last edited by Yogesh Sawant; 05-13-2010 at 07:23 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add spaces between Characters

I need to add spaces in between characters in a string variable. Is there a shortcut? I know you can remove the spaces with sed, but does sed have a way to add them? Example: I have: DATA01 I want it to be: D A T A 0 1 What I have done so far is to create a function... (4 Replies)
Discussion started by: heyindy06
4 Replies

2. UNIX for Dummies Questions & Answers

Replace only first found white spaces with some other characters

Anybody can help me How can I replace only four first white spaces with , or any other characters aaaa 08/31/2004 08/31/2009 permanent Logical Processors in System: 64 bedad 08/16/2001 08/15/2011 permanent Logical Processors in System: 64 badnv14 05/31/2008 05/30/2013 permanent Logical... (5 Replies)
Discussion started by: pareshan
5 Replies

3. Shell Programming and Scripting

Replace several numbers with respective tag and make a single file

Dear All, I have a final output files as 736645|0| 13879|1| 495563|10| 127933|14| 4975|16| 49038|6| 53560|7| 135115|8| 178857|9| Now I want to replace second column with respective tag as per the value (4 Replies)
Discussion started by: jojo123
4 Replies

4. AIX

Replace all TAB characters with white spaces

Dear Gurus Can you please advise me on how to Replace all TAB characters with white spaces in a text file in AIX? Either using vi or any utilities (2 Replies)
Discussion started by: tenderfoot
2 Replies

5. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

6. Shell Programming and Scripting

Need to replace XML TAG

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)
Discussion started by: siva83
2 Replies

7. How to Post in the The UNIX and Linux Forums

How to replace value of password tag in xml with blanks when special characters are there?

Hi All, I am trying to replace the values inside <password> tag in an xml file but it doesn't replace certain passwords: For eg: Server/home/sperinc>cat TextXML.txt <appIds> <entry name="AccountXref"> <type id="ldap"> <realm>nam</realm> ... (7 Replies)
Discussion started by: saroopkris85
7 Replies

8. Shell Programming and Scripting

sed search and replace after xml tag

Hi All, I'm new to sed. In following XML file <interface type='direct'> <mac address='52:54:00:86:ce:f6'/> <source dev='eno1' mode='bridge'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> ... (8 Replies)
Discussion started by: varunrapelly
8 Replies

9. Shell Programming and Scripting

XML files with spaces in the tag name, parse & display?

Greetings all, I have an XML file that is being generated from my application, here is a sample of the first tag (That I am trying to remove and display in a list..) Example- <tag one= "data" data="1234" updateTime="1300"> <tag one= "data1" data="1234" updateTime="1300"> <tag... (5 Replies)
Discussion started by: jeffs42885
5 Replies

10. Shell Programming and Scripting

Find a tag with data and replace its data in another tag

Hi I have one file, :16R::GENL :20C::RELA//SET//ABC123456 :22F::XYZYESR :20C::MITI//NETT/QWERTY12345 :16S::GENL :16R::GENL :20C::RELA//SET//XYZ23456 :22F::XYZYESR :16S::GENL The requirement is, if :20C::MITI// is present in any block, then replace the data of :20C::MITI// in... (8 Replies)
Discussion started by: Soumyadip Dutta
8 Replies
tag(3tcl)                                                                                                                                tag(3tcl)

NAME
tag - Manipulate tagged files SYNOPSIS
tag option ?arg arg ...? DESCRIPTION
The tag procedure provides a number of options for manipulating tagged files. COMMANDS
tag readfile filename Reads the file with the given filename and returns a list where each list element is a tag record, which is represented by a list of label-value pairs, or label-value-endlabel triples. The tag header is the first element returned. tag writefile filename list Takes a list in the format used internally in tcl programs for tagged data and writes it as a tagged file. tag extract list tests Takes a list in tagged format, and a list of conditions, and returns a new list in tagged format which contains those tag records which match the conditions. The tests is a list of test items, each of which is a list of the form { labelname condition matchvalue } The conditions are == String equals != String not equal <= Less than or equal -in Is the test value a member of the list given as the matchvalue -contains Does the match value contain the test value as a case insensitive substring. -earlier Date earlier -later Date later - dates are in ISO format (yyyy-mm-dd [hh:mm:ss]). -exists Does the label exist in this record. BUGS
tag readfile reads the whole file into memory before turning it into a list. Should be more memory efficient. The -earlier and -later comparisons require TCL8.3 AUTHOR
John Lines (john@paladin.demon.co.uk) July 3, 2000 tag(3tcl)
All times are GMT -4. The time now is 12:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy