I was doing a basic shell script and got a datafile that I need to edit a bit to work with it. The thing is it has multiple lines repeated and even words, so I wanted to fast-edit with vim's substitution commands or just a sed. The thing is I did not achieve to match the path I want to substitute to 'nothing' basically.
The actual file is bigger, I'll paste just a part of it but think it has lots of lines like this:
Category.php">category.php
Copyright.php">Copyright.php
Core.php">Core.php
Credit.php">Credit.php
So the thing is, I want to delete the ">category.php
part as I don't need it hence, I got myself to this regex:
\">[A-z]+\.php[ ]+
// So in case it has some spaces, I add the that character class with basically a space. I also escaped the first double quote just in case it makes some trouble but with no success, neither vim nor sed deletes that part.
The actual commands I ran were:
sed "s/\">[A-z]+.php//g"
and :%s/\">[A-z]+.php//g
in vim.
xmlstarlet
. Could you reformulate your question in terms of deleting parts of XML depending on the values of attributes in tags, and show a larger portion of the document, please?