How to read & count XML records from a file in UNIX shell Script

2016-03-24T22:01:25

I have records inside the XML tags, and I want to get the count of them. In below, e.g. the contents inside the <record> </record> tag should be counted as 1. So for the example below, the count should be 2:

<record>
    hi
    hello
</record>

<record>
    follow
</record>

Could somebody help me with the Unix Shell Script?

Copyright License:
Author:「Sanjay malhotra」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/36202022/how-to-read-count-xml-records-from-a-file-in-unix-shell-script

About “How to read & count XML records from a file in UNIX shell Script” questions

Many people have shown how to keep spaces when reading a line in bash. But I have a character based algorithm which need to process each end every character separately - spaces included. Unfortuna...
I have the following test example to be able to use read, but encounters some problem: #lang racket (struct test (num) #:prefab) (define s3 (read (open-input-string "((AK= #s(test .)) (AV))"))) (m...
My apologies if my question is not well worded but I seem to have a lack of words to specifically ask. I found a line that results in a list of all multiples of three from 1 to 1000 while searchin...
I would like to read a manual of read command of shell. I tried man read And I got a manual of read but it is a manual of read of C language. How to get manual of read of shell? Thank you very ...
If the server never send EOF, will InputStream.read hang? How to set the read timeout?
Hello I am a beginner in nodejs and I am trying to process large text files. How do you split read streams to multiple read streams(by line)? logic: read aws s3 file using a read stream split read
I'm programming in Vala language and I've a problem: I don't know how to read a char (although I know how to read a string and an integer). string name = stdin.read_line(); int maximum = int.parse(...
I need some help with the serial port (UART) read function. I need to read in and display the hex value, but currently I'm reading in the ASCII values. to send the hex over the UART I use char d...
A question in order to understand how spark does its job. When you use: spark.read.parquet(sourcePath).{transformation}.{action} How is are the parquet files read? Is it done on the driver and then
I have a 2 part question on reading from sockets and how is it managed on Ruby servers like Unicorn or Mongrel I've learnt that to read from a socket is different from reading a file and that ther...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.