Hi,
If i have a file with xml format, i would like to remove duplicated records and save to a new file. Is it possible...to write script to do it? (8 Replies)
Hi,
I am new to UNIX scripting and woiuld appreicate your help...
Input file contains only one (but long) record:
aaaaabbbbbcccccddddd.....
Desired file:
NEW RECORD #new record (hardcoded) added as first record - its length is irrelevant#
aaaaa
bbbbb
ccccc
ddddd
...
...
... (1 Reply)
Hi guys,
i have a big file with the following format.This includes header(H),detail(D) and trailer(T) information in the file.My problem is i have to search for the character "6h" at 14 th and 15 th position in all the records .if it is there i have to write all those records into a... (1 Reply)
Hi
I have an xml file which has multiple xml records..
I don't know how to read those records and pipe them to another shell command
the file is like
<abc>z<def>y<ghi>x........</ghi></def></abc> (1st record)
<jkl>z<mno>y<pqr>x........</pqr></mno></jkl> (2nd record)
Each record end... (4 Replies)
Hi all
I want to inquire that is there any unix command that can help me while extracting first and last line in a file ( TEST.dat)
for example in the below record i want to extract the line that are in BOLD text or in other words i want to extract line no 1,3,4 and 7
aa 1 2 3
aa 2 3 4... (5 Replies)
Hi All,
I have a requirement to perform the following checks.
Input file is a "|" delimited file and looks like this.
A|c1|c2|c3|....
B|G1|G2|G3....
C|H1|H2|H3...
A|c4|c5|c6|....
B|G4|G5|G6....
C|H4|H5|H6...
Now the check is to see if all the "A" records have a corresponding B... (7 Replies)
find pattern, delete line with pattern and 3 lines above and 8 lines below the pattern. The pattern is "isup". The entire record with starting tag <record> and ending tag </record> containing the pattern is to be deleted and the rest to be retained.
<record>
... (4 Replies)
I have data coming in the below format for each record
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies
LEARN ABOUT DEBIAN
stag-grep
STAG-GREP(1p) User Contributed Perl Documentation STAG-GREP(1p)NAME
stag-grep - filters a stag file (xml, itext, sxpr) for nodes of interest
SYNOPSIS
stag-grep person -q name=fred file1.xml
stag-grep person 'sub {shift->get_name =~ /^A*/}' file1.xml
stag-grep -p My::Foo -w sxpr record 'sub{..}' file2
USAGE
stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE -q tag=val FILE
stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE SUB FILE
stag-grep [-p|parser PARSER] [-w|writer WRITER] NODE -f PERLFILE FILE
DESCRIPTION
parsers an input file using the specified parser (which may be a built in stag parser, such as xml) and filters the resulting stag tree
according to a user-supplied subroutine, writing out only the nodes/elements that pass the test.
the parser is event based, so it should be able to handle large files (although if the node you parse is large, it will take up more
memory)
ARGUMENTS
-p|parser FORMAT
FORMAT is one of xml, sxpr or itext, or the name of a perl module
xml assumed as default
-w|writer FORMAT
FORMAT is one of xml, sxpr or itext, or the name of a perl module
-c|count
prints the number of nodes that pass the test
-filterfile|f
a file containing a perl subroutine (in place of the SUB argument)
-q|query TAG1=VAL1 -q|query TAG2=VAL2 ... -q|query TAGN=VALN
filters based on the field TAG
other operators can be used too - eg <, <=, etc
multiple q arguments can be passed in
for more complex operations, pass in your own subroutine, see below
SUB a perl subroutine. this subroutine is evaluated evry time NODE is encountered - the stag object for NODE is passed into the subroutine.
if the subroutine passes, the node will be passed to the writer for display
NODE
the name of the node/element we are filtering on
FILE
the file to be parser. If no parser option is supplied, this is assumed to a be a stag compatible syntax (xml, sxpr or itext);
otherwise you should parse in a parser name or a parser module that throws stag events
SEE ALSO
Data::Stag
perl v5.10.0 2008-12-23 STAG-GREP(1p)