Sponsored Content
Top Forums Shell Programming and Scripting Shell Script syntax for XML processing Post 302164475 by KevinADC on Tuesday 5th of February 2008 02:21:09 AM
Old 02-05-2008
A perl solution:

Code:
#!/usr/bin/perl
use strict;
use warnings;
my ($start,$end) = @ARGV;
unless ($start =~ /^\d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d$/ && 
        $end   =~ /^\d{4}-\d\d-\d\d\s+\d\d:\d\d:\d\d$/) {
   die qq{Usage: perl path/to/count.pl "start" "end"
start and end = "YYYY-MM-DD HH:MM:SS" including quotes};
}
my $count = 0;
(my $s = $start) =~ tr/- ://d;
(my $e = $end)   =~ tr/- ://d;
open (my $in, 'path/to/input_file') or die "$!"; 
while(<$in>){
    if (/^(\d\d\d\d)-(\d\d)-(\d\d)\s+(\d\d):(\d\d):(\d\d)/) {
        $count++ if ($e ge "$1$2$3$4$5$6" && "$1$2$3$4$5$6" ge $s);
    }
}
close $in;
print "Number of messages found between $start and $end: $count\n";

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script not processing if statement properly

Hi I am trying to create a shell script that will look for a contracthead file first and if the contract head file does not exist on day1 exit script. Now on day2 if contracthead exists or not run the script uploading files in order such as contract line then contract contact so the... (2 Replies)
Discussion started by: jonathan184
2 Replies

2. Shell Programming and Scripting

need help on xml processing

I am trying to divide a xml file(my.xml) like this: <?xml version="1.0" encoding="UTF-8"?> <Proto PName="hmmmmmmm"> <Menu id="A" ver="1"> <P> <P name="AA" Type="X"/> <P name="BB" Type="Y"/> <P name="CC" Type="Z"/> </P> ... (4 Replies)
Discussion started by: demoprog
4 Replies

3. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

4. Shell Programming and Scripting

Help Syntax Shell-Script

Hi Guys, iīve a question ... but itīs a litte bit tricky: iīve a 3 php-scripts which runīs via cron at night. These script reads an xml-file a writes it in an MySQL-DB. I named them (for example here ) Script1 - Script3. The XML-Files i named xml1 - xml3. Now, iīve build a Batch-file,... (10 Replies)
Discussion started by: jackcracker
10 Replies

5. Shell Programming and Scripting

2 file processing script in C shell

I want to use an awk for the following scenario but not sure if it will work or not. I have two input file: F1 and F2 F1 02 05 08 F2 00 01 02 03 04 05 06 07 08 09 10 (1 Reply)
Discussion started by: jclanc8
1 Replies

6. Shell Programming and Scripting

Help with shell script for url processing

Hi, My objective is to make a shell script that, when run, you can input multiple links at once. text is then inserted between the http:// part and the following url. example : http://google.be ==> http://sometext.google.be it would be great if it could then open all the created links (wich... (5 Replies)
Discussion started by: tooster
5 Replies

7. Shell Programming and Scripting

File Processing in shell script

i have a file with following type of data abcd : gggggg gggggg ; 1234 gggggg ; 5678 gggggg ; 3434 gggggg ; 6565 gggggg ; 1231 1234 ; vvvv ;Eng=Myfirstname 5678 ; xyzf ;Eng=Mysecondname 3434 ; xyzf ;Eng=Mythirdname 6565 ; xyzf ;Eng=Mysfourthname 1231 ; xyzf ;Eng=Mysfifthname... (7 Replies)
Discussion started by: telangmadhuri
7 Replies

8. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

9. Programming

help me with perl script xml processing

Hi everyone, I have Xml files in a folder, I need to extract some attribute values form xml files and store in a hash. My xml file look like this. <?xml version="1.0" encoding="UTF-8"?> <Servicelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"... (0 Replies)
Discussion started by: pavani reddy
0 Replies

10. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies
GLDRAWRANGEELEMENTS(3G) 												   GLDRAWRANGEELEMENTS(3G)

NAME
glDrawRangeElements - render primitives from array data C SPECIFICATION
void glDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) PARAMETERS
mode Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_QUAD_STRIP, GL_QUADS, and GL_POLYGON are accepted. start Specifies the minimum array index contained in indices. end Specifies the maximum array index contained in indices. count Specifies the number of elements to be rendered. type Specifies the type of the values in count. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT. indices Specifies a pointer to the location where the indices are stored. DESCRIPTION
glDrawRangeElements is a restricted form of glDrawElements. mode, start, end, and count match the corresponding arguments to glDrawElements, with the additional constraint that all values in the arrays count must lie between start and end, inclusive. Implementations denote recommended maximum amounts of vertex and index data, which may be queried by calling glGet with argument GL_MAX_ELEMENTS_VERTICES and GL_MAX_ELEMENTS_INDICES. If end - start + 1 is greater than the value of GL_MAX_ELEMENTS_VERTICES, or if count is greater than the value of GL_MAX_ELEMENTS_INDICES, then the call may operate at reduced performance. There is no requirement that all vertices in the range [start, end] be referenced. However, the implemen- tation may partially process unused vertices, reducing performance from what could be achieved with an optimal index set. When glDrawRangeElements is called, it uses count sequential elements from an enabled array, starting at start to construct a sequence of geometric primitives. mode specifies what kind of primitives are constructed, and how the array elements construct these primitives. If more than one array is enabled, each is used. If GL_VERTEX_ARRAY is not enabled, no geometric primitives are constructed. Vertex attributes that are modified by glDrawRangeElements have an unspecified value after glDrawRangeElements returns. For example, if GL_COLOR_ARRAY is enabled, the value of the current color is undefined after glDrawRangeElements executes. Attributes that aren't modified maintain their previous values. NOTES
glDrawRangeElements is available only if the GL version is 1.2 or greater. glDrawRangeElements is included in display lists. If glDrawRangeElements is entered into a display list, the necessary array data (deter- mined by the array pointers and enables) is also entered into the display list. Because the array pointers and enables are client-side state, their values affect display lists when the lists are created, not when the lists are executed. ERRORS
It is an error for indices to lie outside the range [start, end], but implementations may not check for this situation. Such indices cause implementation-dependent behavior. GL_INVALID_ENUM is generated if mode is not an accepted value. GL_INVALID_VALUE is generated if count is negative. GL_INVALID_VALUE is generated if end < start. GL_INVALID_OPERATION is generated if glDrawRangeElements is executed between the execution of glBegin and the corresponding glEnd. ASSOCIATED GETS
glGet with argument GL_MAX_ELEMENTS_VERTICES glGet with argument GL_MAX_ELEMENTS_INDICES SEE ALSO
glArrayElement, glColorPointer, glDrawArrays, glDrawElements, glEdgeFlagPointer, glGetPointerv, glIndexPointer, glInterleavedArrays, glNormalPointer, glTexCoordPointer, glVertexPointer GLDRAWRANGEELEMENTS(3G)
All times are GMT -4. The time now is 04:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy