Another question, what if the file that I will use will come from the output of a command? Instead of specifying a in (open(FILE, "<", "a"), I need to get the file a which will be the output of a command. How can I modify the script to do that? Thank you so much!
Hello All,
I am new to this and I need to parse an XML file.
Here's the XML Input File:
<Report version="1.2">
<summary fatals="0" testcases="1" expected_fails="0" unexpected_passes="0" warnings="9" tests="21" errors="0" fails="1" passes="20" />
<testresult... (4 Replies)
Hi All,
My requirement is create an unix script to parse the xml file and display the values of the Elements/value between the tags on console. Like say, I would like to fetch the value of errorCode from the below xml which is 'U007' and display it. Can we use SED command for this? I have tried... (10 Replies)
Hi,
It's been a few years since college when I did stuff like this all the time. Can someone help me figure out how to best tackle this problem? I need to parse a file full of entries that look like this:
<eq action="A" sectyType="0" symbol="PGR" exch="CA" curr="VEF" sess="NORM"... (7 Replies)
Hi All,
I have been working on something that doesn't seem to have a clear regex solution and I just wanted to run it by everyone to see if I could get some insight into the method of solving this problem.
I have a flat text file that contains billing records for users, however the records... (5 Replies)
Hi Everybody,
I have an XML file containing some data and i want to extract it, but the specific issue in my file is that the data is repeated some times like the following example :
<section1>
<subsection1>
X=...
Y=...
Z=...
<\subsection1>
<subsection2>
X=...
Y=...
Z=...... (2 Replies)
Hi,
I have to make an script according to these:
- I have couples of files like:
xxxxxxxxxxxxx.csv
xxxxxxxxxxxxx_desc.xml
- every xml file has diferent fields, but keeps this format:
........
<defaultName>2011-02-25T16:43:43.582Z</defaultName>
........... (2 Replies)
In the wake of the post: how-parse-following-xml-file
Thank you for the very useful chakrapani response 302355585-post4 !
A close question.
How to pass a file to xmllint in variable?
For example, let it be:
NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
Hi,
Can anybody help to solve this. I want to parse some xmldata along with the URL in the Shell.
I'm calling the URL via the curl command
Given below is my shell script file
export... (7 Replies)
Hi
I have xml file with multiple records and would like to extract records from xml with specific condition if specific tag is present extract entire row otherwise skip .
<logentry revision="21510">
<author>mantest</author>
<date>2015-02-27</date>
<QC_ID>334566</QC_ID>... (12 Replies)
Discussion started by: madankumar.t@hp
12 Replies
LEARN ABOUT ULTRIX
fopen
fopen(3s)fopen(3s)Name
fopen, freopen, fdopen - open a stream
Syntax
#include <stdio.h>
FILE *fopen (filename, type)
char *filename, *type;
FILE *freopen (filename, type, stream)
char *filename, *type;
FILE *stream;
FILE *fdopen (fildes, type)
int fildes;
char *type;
Description
The routine opens the file named by filename and associates a stream with it. The routine returns a pointer to the FILE structure associ-
ated with the stream.
The filename points to a character string that contains the name of the file to be opened.
The type is a character string having one of the following values:
"r" Open for reading
"w" Truncate or create for writing
"a" Append; open for writing at end of file, or create for writing
"A" Append with no overwrite; open for writing at end-of-file, or create for writing
"r+" Open for reading and writing
"w+" Truncate or create for reading and writing
"a+" Append; open or create for reading and writing at end-of-file
"A+" Append with no overwrite, open or create for update at end-of-file
The letter "b" can also follow r, w, or a. In some C implementations, the "b" is needed to indicate a binary file, however, it is not
needed in ULTRIX. If "+" is used, the "b" may occur on either side, as in "rb+" or "w+b".
The routine substitutes the named file in place of the open stream. The original stream is closed, regardless of whether the open ulti-
mately succeeds. The routine returns a pointer to the FILE structure associated with stream.
The routine is typically used to attach the preopened streams associated with stdin, stdout and stderr to other files.
The routine associates a stream with a file descriptor. File descriptors are obtained from or which open files but do not return pointers
to a FILE structure stream. Streams are necessary input for many of the Section 3s library routines. The type of stream must agree with
the mode of the open file.
When a file is opened for update, both input and output may be done on the resulting stream. However, output may not be directly followed
by input without an intervening or and input may not be directly followed by output without an intervening or an input operation which
encounters end-of-file.
When a file is opened for append with no overwrite (that is when type is "A" or "A+"), it is impossible to overwrite information already in
the file. The routine may be used to reposition the file pointer to any position in the file, but when output is written to the file, the
current file pointer is disregarded. All output is written at the end of the file and causes the file pointer to be repositioned at the
end of the output. If two separate processes open the same file for append, each process may write freely to the file without fear of
destroying output being written by the other. The output from the two processes will be intermixed in the file in the order in which it is
written.
Return Values
The and routines return a NULL pointer on failure.
Environment
SYSTEM_V
When your program is compiled using the System V environment, append with no overwrite is specified by using the "a" or "a+" type string,
and the "A" and "A+" type strings are not allowed.
POSIX
In the POSIX environment, the "a" and "a+" strings, and the "A" and "A+" strings specify append with no overwrite.
See Alsocreat(2), dup(2), open(2), pipe(2), fclose(3s), fseek(3s).
fopen(3s)