SED Delete all between 2 tags ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SED Delete all between 2 tags ...
# 1  
Old 06-08-2010
SED Delete all between 2 tags ...

Hi @all,

i need an SED-command which deletes all signs in an xml-file between the </text> and the following <text> - tags.

Code:
sed '/</text>/,/<text>/d'

doesn`t work!

regards
alex
# 2  
Old 06-08-2010
Hi,

try:
Code:
sed '/<\/text>/,/<text>/d'

# 3  
Old 06-08-2010
hi ripat,

no - doesn`t work.
I tried that in the first place - but i get a failure [unvalid escape-tag]

Is there another possibilty to solve this?

alex
# 4  
Old 06-08-2010
Does any of these sooth your need?
Code:
awk '/<\/text>/,/<text>/{next}1' file_name
sed '/<\/text>/,/<text>/d' file_name

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed match exactly and delete

I am using following sed rule to delete 2 lines after a pattern match inclusive. # cat /tmp/temp.txt dns.com 11 22 mydns.com 11 22 dns.com.au 11 22 LAST LINE # cat /tmp/temp.txt | sed -e '/dns.com/,+2d' LAST LINE I just need to remove lines below dns.com only and NOT below... (5 Replies)
Discussion started by: anil510
5 Replies

2. Shell Programming and Scripting

sed to delete ^M

I am trying to use sed to delete the ^M at the end of the line and when i pass a file './asciiFix.sh wintest.txt' I get an error saying sed: can't read : no such file or dir. Can someone give me a pointer as to what I am doing wrong? #!/bin/sh if file "$@" | grep "with CRLF"; then echo... (5 Replies)
Discussion started by: kwatt019
5 Replies

3. Shell Programming and Scripting

sed - delete content inside tags multiline

I need that a certain part of the content below excluded ==Image Gallery== followed by <gallery> and the content until </gallery> test SED1 ==Image Gallery== <gallery> Image:car1.jpg| Car 1<sup>1</sup> Imagem: car2.jpg| Car2<sup>2</sup> </gallery> test SED2 ==Image... (5 Replies)
Discussion started by: dperboni
5 Replies

4. Shell Programming and Scripting

sed delete

I am not able to analyze the below code.. What I expected is that DELETED will be replaced with the first field in every line.But after giving a try, the output was different. Can anyone pleas analyze and explain the code in detail? Many thanks... $ sed 's/* /DELETED /g' g1.txt > g4.txt... (2 Replies)
Discussion started by: giridhar276
2 Replies

5. Shell Programming and Scripting

sed to delete character 0 only when it's on its own?

Hi all I am trying to get my head around doing the following.... I have an input field that could contain either a number a blank field or a whitespace field. What I want to do is delete a 0 (zero) if it's on its own or leading the number. So:- \t0 delete the zero 0 delete the... (8 Replies)
Discussion started by: Bashingaway
8 Replies

6. Shell Programming and Scripting

USING sed to delete a line

Please let me know wat would be sed command to delete any partcular line from a file and also moving lines below it to up. ie wen line #9 is deleted data in line #10 should move to #9 and so on. (2 Replies)
Discussion started by: fidelis
2 Replies

7. Shell Programming and Scripting

sed-delete

Guys, file1: test \ 123 cat file1 | sed '/test \/d' ---- does not work I have to remove the line "test \" in file1 can somebody help ? (7 Replies)
Discussion started by: giri_luck
7 Replies

8. Shell Programming and Scripting

delete using sed

hi , i need to delete all the lines in a file except a line which starts with the letter SP (6 Replies)
Discussion started by: mhdmehraj
6 Replies

9. UNIX for Dummies Questions & Answers

Delete ^ using sed

Hi All, I am very new to UNIX... I was trying to delete ^ from a file and save it with different name... The version is AIX 5.3 The input file is in this directory /a/b The Input file name is o9876.out I want the output file in same path with different name like ABC.txt... (5 Replies)
Discussion started by: us_pokiri
5 Replies

10. Shell Programming and Scripting

Use sed to delete a character

I built a 12 million record file and made a mistake, one field is 1 character too long. The record is 40 bytes and ends always in 999. I am trying to delete the 37 character in each record. Is this possible without doing a cut and paste. (1 Reply)
Discussion started by: bthomas
1 Replies
Login or Register to Ask a Question