[SLE] [Somewhat OT] Getting the middle part of a file.
From: The Purple Tiger (Jon_at_tigersden.demon.co.uk)
To: firstname.lastname@example.org Date: Thu, 18 Sep 2003 14:03:16 +0100
This is a bit OT, but not so OT as to go to the OT list IMHO :)
System is SuSE8.2
What I am trying to do:
I have a large number of html files that have a segment in them I would
like to copy out and save to another file.
The segment I want is after a unique table tag [unique in that whilst
there are other table tags, there are none like this one, and it is the
same in each file]. I want to capture up until the closing table tag.
ALSO I am trying to make sure that the first 4 lines [if you include the
table tag] and the last 4 lines [if you include the closing tag] don't
get copied to the file :)
I don't ask for much, do I? ;)
What I have discovered so far:
I can use:
grep -i "table tag stuff goes here"
to get the first line, without case mattering [which isn't essential as
I think they are all exactly the same, but just in case...]. I can
grep -iA 10 "table tag stuff goes here"
to get the 10 lines of output including the matching line.
I can use -B instead to get the 10 lines preceding the table tag at the
end, if it is unique [which the closing tag isn't].
Anyone have any good 1 or 2 liners that would help me out here? Or maybe
something a bit longer :)
Thanks for reading this :)
-- Check the headers for your unsubscription address For additional commands send e-mail to email@example.com Also check the archives at http://lists.suse.com Please read the FAQs: firstname.lastname@example.org