Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok ... thanks for explaining further Although I am a little more confused
Is the data you are showing supposed to be on a single line? If not, I am not sure I see how the regex '<path.*/>' would encompass what we are seeing?
Also you do not elude to what you are using to parse this data, ie sed, perl, ruby, etc...
This is to me is one line. "<path" is the opening tag and "/>" is the closing tag.
Because it is a SVG-file (which is a XML-file), many lines start with the "<path"-tag. But I only want to delete the path-lines with a particular line of code in it: the ones with the clip-path line.
I am cleaning up the above mentioned SVG-file. A lot of code needs to be removed. Not just in this file. But in other files the same creator has made:https://commons.wikimedia.org/wiki/C...lta_in_Spanish. So I am trying to find an automation.
Now I that look at it again, I think it can only be done with perl or ruby. I have some working knowledge with regex but almost no knowledge of perl.
Last edited by validator456; 08-03-2014 at 02:11 PM.
Well if we can assume that the data is on one line, it would be as easy as:
Code:
sed -i '/<path.*clip-path/d' file
This will remove all lines in a file where '<path' appears before 'clip-path'
If this is not the desired affect and it really is over multiple lines, you will need some form of a looping structure to capture what you are looking for.
for me it looks like a multi-line regexp, probably with perl:
read whole file in a variable, and
s!<path[^/]+clip[-]path[^/]+/>!!gm
I have not tested, probably you need to check greediness too
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.