This is a notification message: there are several files in each package, and we need to extract these file names in order to count how many files are notified in the log
[INFO] 2017-02-22 23:28:36/070 Notfiy INFO: <NotifyInfo Id ='1487777316070'> <DataCatalog>lte_s10_s11</DataCatalog> <WorkMode>WSFTP</WorkMode> < SystemID > IPMS < / SystemID > < the ConnectionString > ftp://10.221.245.66 < / ConnectionString > < Path > / 20170222/23 / lte/s11 < / Path > <UserName>dxpanalysis</UserName> <Password>dxpanalysis@123</Password> <Files> <Filename createTime='2017-02-22T23:28:24'>001_201702222325_0220_07.CSV</Filename> <Filename createTime='2017-02-22T23:28:24'>001_201702222325_0227_05.CSV</Filename> <Filename createTime='2017-02-22T23:28:24'>001_201702222325_0208_06.CSV</Filename> <Filename createTime='2017-02-22T23:28:24'>001_201702222325_0231_05.CSV</Filename> <Filename createTime='2017-02-22T23:28:25'>001_201702222325_022f_04.CSV</Filename> </Files> </NotifyInfo> location:com.nokia.business.SendMessage.run(SendMessage.java:94)Copy the code
How to extract file names
If you split the file name into a single line, filter CSV, replace > with a newline character, and replace CSV with CSV\n, the file name becomes a separate line. We do this with sed substitution
<Filename createTime='2017-02-22T23:28:24'>001_201702222325_0220_07.CSV</Filename>
Copy the code
Testing:
cat test | sed 's/CSV/CSV\n/g' |sed 's/>/\n/g' |grep CSV |wc -l
Copy the code