In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
ParseXmlFile.sh
#! / bin/bash
Usage ()
{
Echo "Usage:. / parseXmlFile.sh"
Exit 1
}
List_all_entity ()
{
Local IFS=\ >
While read-d\
< ENTITY CONTENT do echo $ENTITY done < $1 } list_all_content() { local IFS=\>While read-d\
< ENTITY CONTENT do echo $CONTENT done < $1 } list_all_tag_name() { local IFS=\>While read-d\
< ENTITY CONTENT do TAG_NAME=${ENTITY%% *} echo $TAG_NAME done < $1 } list_all_attributes() { local IFS=\>While read-d\
< ENTITY CONTENT do ATTRIBUTES=${ENTITY#* *} echo $ATTRIBUTES done < $1 } getattr() { ATTR_PAIR=${1#*$2=\"} echo "${ATTR_PAIR%%\"*}" } get_attributes_value() { local IFS=\>While read-d\
< ENTITY CONTENT do TAG_NAME=${ENTITY%% *} ATTRIBUTES=${ENTITY#* *} if [[ $TAG_NAME == $2 ]] then value=`getattr ${ATTRIBUTES} ${3}` echo $value fi done < $1 } get_content_value() { local IFS=\>While read-d\ < ENTITY CONTENT
Do
TAG_NAME=$ {ENTITY%% *}
If [[$TAG_NAME = = $2]]
Then
Echo $CONTENT
Fi
Done < $1
}
# main in this shell
If [$#-ne 1]
Then
Usage
Fi
If [!-f $1]
Then
Echo "fail to load data from file, file $1 not exist!"
Exit 1
Fi
List_content $1
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.