Hi:
I am currently working on a program which requires direct its ouput to a file here is an example
./proram arg_1 arg_2
when program ends all output will be arg_2 file
Is that possible I am not a bad programmer, However I am stuck there.
Can anyone give a hint?
Thanks
SW (1 Reply)
Ahhhrrrggg I'm having a brain fart...
I want to take the output of a command and redirect it to a file...
This works....
$ man cp | cat >> copy_help
but this doesn't
keytool -help |cat >> keytool_help
It just produces... these lines...
more keytool_help
] ...
... (11 Replies)
Hi,
I am writing the following code in command prompt it is working fine.
grep ',222,' SAPPCO_20080306.CSV_old > SAPPCO_20080306.CSV_new
But the command is not working in the Shell Script...
##########################################
#!/bin/sh
#... (2 Replies)
Hi all!!
is possible to assign the output of some command to filename, i.e.
grep_output.txt
Otherwise, I want to open a new file which name is inside another, how can I do it?
Thanks a lot! (7 Replies)
Hi All,
I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it.
my ls -ltr output will be as below.
-rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl
-rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl
I want my new file... (6 Replies)
I am trying to get following result from the scipt I have. First time it generates the o/p in correct format. However if I run it again it appends to the existing file. I would like to see o/p on screen as well as save it in file. Everytime it should create new file.
## I/P file
0174
0175... (3 Replies)
Hi,
I want to know how to redirect the output of topas -P to a file in a readable format. I tried doing it by using
topas -P > topas.txt but the output is not properly aligned and when I opened it using vi it ahd some characters.
Please help me out in this.
Thanks (1 Reply)
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
... (4 Replies)
Hi Guys,
I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts.
I used below but it is not working:
OFILE=/home/home1/report1
echo "report1 details" > $OFILE
=/home/home1/1.sh > $OFILE
echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies
LEARN ABOUT ULTRIX
fdopen
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)