我有一个文件 input.txt,里面有很多奇怪的字符、html 标签和有用的材料。我想在“描述”一词之后显示 35 个字符,不包括像 $&lmp 这样的奇怪字符,并且在新文件 output.txt 中没有 html 标记。
输入样本:
</image>
<title>A Londoner Looks Back: Were The Olympics Awesome?</title>
<link>http://www.askmen.com/sports/fanatic/london-olympics-post-mortem.html</link>
<description rdf:parseType="Literal">
The other evening I walked out of London&rsquo;s <a
href="http://www.askmen.com/fashion/watch_100/135_olympic-watches.html">Olympic
stadium onto the new &ldquo;Javelin&rdquo; train into town. (The journey from east to
central London, quite recently still something of a commuter&rsquo;s nightmare, took just
six minutes.) A railway worker on the platform didn&rsquo;t just point everyone the way
onto the train; he did a dance for us. You don&rsquo;t usually get that on London
transport. These Olympics made the city happier.I now live in Paris, but I
consider myself a Londoner. I went to nursery school in London, spent 15 years of my life
in the city, speak in a London accent, visit my parents and siblings here, and, as someone
of mongrel origin who belongs nowhere, I feel at home in the world&rsquo;s most
cosmopolitan city. To steal a line from the 1980s film Sammy and Rosie Get Laid:
&ldquo;I&rsquo;m not English. I&rsquo;m a Londoner.&rdquo; But London is also a sprawling,
gray, wet, overpriced city where traveling anywhere always seems to take forever, and
Londoners are not positive people. In fact, we are whiners. Going into the
Olympics, the whining was at full blast. Landing in London days before <a
href="http://www.askmen.com/sports/bodybuilding/olympic-bobsledding.html">the Games
began, I found my friends and family full of dread. The Games&rsquo; organizers had
indicated that while the Olympics were on, traveling anywhere would take even longer than
forever. My sister had been told to be at her desk at 7 a.m. during the Games to avoid the
rush hour -- this in a city where many people start work nearer to 10 a.m. A friend showed
me a kind of war scenario prepared by the bank where he worked, full of ominous questions
like, &ldquo;What if your supply chain stopped?&rdquo; &ldquo;What if your technology
failed?&rdquo; &ldquo;What if your brand, image and reputation were impacted by any of the
above?&rdquo; And what was all this upheaval in aid of? To watch some doped-up
moustachioed Eastern European women win incomprehensible weightlifting events? In a YouGov
survey days before the opening ceremony, only 51% of Britons expressed an interest in the
Olympics -- and that was a lot better than earlier surveys.On the day of the
opening ceremony I happened to have a meeting down the street from my last <a
href="http://www.askmen.com/london/">London address (a shared flat above a now defunct
liquor store). I ran to Baker Street tube, as I&rsquo;d done a thousand times before. Then
I got on a media bus to the opening ceremony that passed Southwark Bridge with the
Financial Times building where I had worked in the 1990s. It was like a dream:
You move through a familiar landscape that has been transformed. The Olympics helped me
see London afresh.It was during the opening ceremony that the mood among
Londoners changed. I know foreigners didn&rsquo;t get all the references: the Windrush
ship that brought the first Jamaican immigrants to Britain in 1948, the BBC weather
forecaster Michael Fish assuring us there would be no hurricane the night before one
struck in 1987, the dance of the state-funded National Health Service nurses. But Londoners got it. Danny Boyle, the director, gave us a multicultural and funny
Britain that had finally shed its imperial delusions of grandeur. The Olympic torch was
run into the stadium not by an Aryan superman but by the pot-bellied middle-aged ex-rower
Steve Redgrave, who can&rsquo;t run. For the first time in my life, Boyle&rsquo;s Britain
made me feel a patriot. The opening ceremony remains the highlight of my Olympics.Then the sports began, and with it the instinctive expectation that the Brits
would fall flat on their faces. We may have invented modern sports, but England&rsquo;s
soccer team hasn&rsquo;t won a prize since 1966, and no British man has won Wimbledon
since 1936. Surely our Olympians would continue the tradition?&nbsp;It seemed
so on the first day, when Britain&rsquo;s much-hyped male cyclists failed to win a medal
or even to figure in the run-in in front of Buckingham Palace. Only on the second day did
our first medal arrive: A silver for cyclist Lizzie Armitstead, a polite young vegetarian
from the rural north so little-known that at the press conference she had to introduce
herself to the nation. &ldquo;I could never get my head around eating corpses,&rdquo; she
explained. On the fourth morning, Britain still had no golds. The more
excitable newspapers began demanding inquests. And then the golds came in a crazy rush,
won by a bunch of underpaid Britons of all colors whose frank delight was irresistible.
Above all, there was Mo Farah, the Somali-born runner, who had arrived in London&rsquo;s
suburbs as an eight-year-old barely able to speak English, and had really wanted to play
on the wing for Arsenal, but who won gold in the 10,000 and 5,000 meters instead. After
his first gold, an African journalist asked if he wouldn&rsquo;t rather have been running
for Somalia. &ldquo;Look, mate, this is my country,&rdquo; replied Farah. He was
Boyle&rsquo;s multicultural Britain. The second Saturday of the Olympics, when
Farah was among six Britons to win gold, was Britain&rsquo;s best sporting day since 1966.
It was our best single Olympic day since the Games were held in London in 1908. Of course,
we embarked on an orgy of patriotism. On BBC TV, the new &ldquo;British heroes&rdquo; were
feted much like &ldquo;heroes of the harvest&rdquo; on North Korean state TV. Foreigners
rightly accused the Britons of practically ignoring the other 200 nations. However,
that&rsquo;s what every country at the Olympics does. Each country watches its own Games.
</item>
<title>How Facial Hair Can Save You From Skin Cancer</title>
<link>http://www.askmen.com/sports/news/moustaches-and-skin-cancer.html</link>
<description rdf:parseType="Literal">
输出应该是这样的:
The other evening I walked out of London Olympic
stadium onto the new Javelin train into town. (The journey from east to
central London, quite recently still
If you thought moustaches were solely to distinguish regular males from porn stars and
hipsters, think again. A new study suggests that
我努力了:
sed 's/^.*<description>/<description>/
s/</</g
s/>/>/g
s/&rsquo;/'"'"'/g
s/&ccedil;/c/g
s/<[^>]*>//g
s/^\(.\{35\}\).*/\1/' inputsample.txt