Using awk/sed/perl i want to remove the self closing tag and its content and add an empty space

jp flag

I have the following string:

<Sub4Topic hi="1d9bhb" cbdshfghfgs(C)(2)(d)"><step stepid=" ajhdjgjgjfhgjhgrhghr" stepid="du" />

Here I want the step tag and its content to be removed. The output should be:

<Sub4Topic hi="1d9bhb" cbdshfghfgs(C)(2)(d)">
kr flag

Well for what you have posted you could use

| sed -r 's/<step[^>]+>/ /'

([^>]+ means some characters that are not >) but if you need something more flexible then please post more of your input.

Zanna avatar
kr flag
er, thanks for the edits folks... not sure how I managed to type that horribly...
bac0n avatar
cn flag
I always forget that last one....

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.