#!/bin/bash
#Get the page source and put it into file tmp.html
curl [url]http://tieba.baidu.com/linux[/url] -o tmp.html
#Get the kz from file tmp.html and put it into file kz.txt
cat tmp.html | grep 'class=t' | awk -F 'kz=' '{print $2}' | awk -F '\"' '{print $1}' > kz.txt
#Get the title from file tmp.html and put it into file title.txt
cat tmp.html | grep 'class=t' | awk -F '_blank >' '{print $2}' | awk -F '<' '{print $1}' > title.txt
#Read the kz from file kz.txt and put it into the array kz
#Read the title from file title.txt and put it into the array title
#One page has 50 titles
kz=()
title=()
for index in {1..50}; do
kz[$index]=`cat kz.txt | head -n $index | tail -n 1`
title[$index]=`cat title.txt | head -n $index | tail -n 1`
done