10 More Discussions You Might Find Interesting
1. HP-UX
Hi all,
This is my first ever posting, so please be gentle with me :)
I'm trying to write a script in HP-UX which outputs text in different colours, but although I can get the script to output different colours to the screen, I can't get it to write different colours to a file. Take the... (4 Replies)
Discussion started by: neilharvey
4 Replies
2. Shell Programming and Scripting
Hi Everyone,
Long time lurker here. I have a project of bringing every one of our data centers to a newly enforced company standard. Standard naming conventions, domain migrations, etc. So, the people who are setting the standards are providing me with a CSV file. Column 1 has the old... (23 Replies)
Discussion started by: Zaphod_B
23 Replies
3. UNIX for Dummies Questions & Answers
I need to enable set -x in my croned script as at times the script is not returning all data that it should be. This only happens intermittently and as such I would like a means of being able to check what goes wrong.
My question is how to output the debug of set -x to file? (1 Reply)
Discussion started by: rob171171
1 Replies
4. Shell Programming and Scripting
With this script the output to the terminal does not increment. Can anyone tell me what I need to do to get this to increment output to the terminal?
Here is the output
mpath major,minor number
ls: /dev/mapper/mpathp1: No such file or directory
raw device output
253,44
echo raw device... (5 Replies)
Discussion started by: bash_in_my_head
5 Replies
5. Homework & Coursework Questions
Stuck on formatting an output. I want to list 6-99 on the screen, looking something like this:
99 98 97 96 95 94 93 92 91 90
89 88 87 86 85 84 83 82 81 80
and so on down to 6.
So far I am only able to print one value per line.
This is what I have
I have defined x as integer x=99... (2 Replies)
Discussion started by: huckknows
2 Replies
6. Shell Programming and Scripting
I have information in a file called HITS. This file has been populated by the user entering search criteria.
the HITS file contains information:
filname.hits: 123.33.345.66 Fri Nov 26 11.45.56.43 GMT 2006
at the moment i am just displayin the information using cat HITS.
... (3 Replies)
Discussion started by: amatuer_lee_3
3 Replies
7. Shell Programming and Scripting
Newbie question -- any help very much appreciated: I want to be able to get grep (or whatever else would work) to return not only matching lines, but also the original input string:
An example may help: Suppose I have two files data1.txt and data2.txt:
data1.txt
Hello my name is foo.
What... (3 Replies)
Discussion started by: tapmas
3 Replies
8. Shell Programming and Scripting
This is the file am having:
"40","1G1AL55 ",30482,9000
"40","1G1ZT58 ",29098,10600
"40","1G1AL15 ",29222,9400
"46","1G6KD57 ",3083,28400
"46","1G6KD57 ",27909,25200
"49","1G1ZU57 ",16391,13900
"49","1G2ZG58 ",28856,12400
I want to display the output in three files... (23 Replies)
Discussion started by: dave_nithis
23 Replies
9. Shell Programming and Scripting
Ok, lets suppose I have two files like so:
file1
John 5441223
Sandy 113446
Jill 489799
file2
Sandy Tuesday
Jill Friday
John Monday
Is it possible to match records from these two files and output them into one output file? For example, lets suppose I want to output like this:
... (5 Replies)
Discussion started by: Liguidsoul
5 Replies
10. Shell Programming and Scripting
I am using sed for a simple substitution (see command syntax below). Everything works fine except that the last line of the input file does not get written to the output file. Has anyone ever seen this and know of way to force the last line to be written?
I don't know if it's playing a part in... (3 Replies)
Discussion started by: 2reperry
3 Replies
funopen(3) SAORD Documentation funopen(3)
NAME
FunOpen - open a Funtools data file
SYNOPSIS
#include <funtools.h>
Fun FunOpen(char *name, char *mode, Fun ref);
DESCRIPTION
The FunOpen() routine opens a Funtools data file for reading or appending, or creates a new FITS file for writing. The name argument speci-
fies the name of the Funtools data file to open. You can use IRAF-style bracket notation to specify Funtools Files, Extensions, and Fil-
ters. A separate call should be made each time a different FITS extension is accessed:
Fun fun;
char *iname;
...
if( !(fun = FunOpen(iname, "r", NULL)) ){
fprintf(stderr, "could not FunOpen input file: %s
", iname);
exit(1);
}
If mode is "r", the file is opened for reading, and processing is set up to begin at the specified extension. For reading, name can be
stdin, in which case the standard input is read.
If mode is "w", the file is created if it does not exist, or opened and truncated for writing if it does exist. Processing starts at the
beginning of the file. The name can be stdout, in which case the standard output is readied for processing.
If mode is "a", the file is created if it does not exist, or opened if it does exist. Processing starts at the end of the file. The name
can be stdout, in which case the standard output is readied for processing.
When a Funtools file is opened for writing or appending, a previously opened Funtools reference handle can be specified as the third argu-
ment. This handle typically is associated with the input Funtools file that will be used to generate the data for the output data. When a
reference file is specified in this way, the output file will inherit the (extension) header parameters from the input file:
Fun fun, fun2;
...
/* open input file */
if( !(fun = FunOpen(argv[1], "r", NULL)) )
gerror(stderr, "could not FunOpen input file: %s
", argv[1]);
/* open the output FITS image, inheriting params from input */
if( !(fun2 = FunOpen(argv[2], "w", fun)) )
gerror(stderr, "could not FunOpen output file: %s
", argv[2]);
Thus, in the above example, the output FITS binary table file will inherit all of the parameters associated with the input binary table
extension.
A file opened for writing with a Funtools reference handle also inherits the selected columns (i.e. those columns chosen for processing
using the FunColumnSelect() routine) from the reference file as its default columns. This makes it easy to open an output file in such a
way that the columns written to the output file are the same as the columns read in the input file. Of course, column selection can easily
be tailored using the FunColumnSelect() routine. In particular, it is easy to merge user-defined columns with the input columns to gener-
ate a new file. See the evmerge for a complete example.
In addition, when a Funtools reference handle is supplied in a FunOpen() call, it is possible also to specify that all other extensions
from the reference file (other than the input extension being processed) should be copied from the reference file to the output file. This
is useful, for example, in a case where you are processing a FITS binary table or image and you want to copy all of the other extensions to
the output file as well. Copy of other extensions is controlled by adding a "C" or "c" to the mode string of the FunOpen() call of the
input reference file. If "C" is specified, then other extensions are always copied (i.e., copy is forced by the application). If "c" is
used, then other extensions are copied if the user requests copying by adding a plus sign "+" to the extension name in the bracket specifi-
cation. For example, the funtable program utilizes "c" mode, giving users the option of copying all other extensions:
/* open input file -- allow user copy of other extensions */
if( !(fun = FunOpen(argv[1], "rc", NULL)) )
gerror(stderr, "could not FunOpen input file: %s
", argv[1]);
/* open the output FITS image, inheriting params from input */
if( !(fun2 = FunOpen(argv[2], "w", fun)) )
gerror(stderr, "could not FunOpen output file: %s
", argv[2]);
Thus, funtable supports either of these command lines:
# copy only the EVENTS extension
csh> funtable "test.ev[EVENTS,circle(512,512,10)]" foo.ev
# copy ALL extensions
csh> funtable "test.ev[EVENTS+,circle(512,512,10)]" foo.ev
Use of a Funtools reference handle implies that the input file is opened before the output file. However, it is important to note that if
copy mode ("c" or "C") is specified for the input file, the actual input file open is delayed until just after the output file is opened,
since the copy of prior extensions to the output file takes place while Funtools is seeking to the specified input extension. This implies
that the output file should be opened before any I/O is done on the input file or else the copy will fail. Note also that the copy of sub-
sequent extension will be handled automatically by FunClose() if the output file is closed before the input file. Alternatively, it can be
done explicitly by FunFlush(), but again, this assumes that the input file still is open.
Upon success FunOpen() returns a Fun handle that is used in subsequent Funtools calls. On error, NULL is returned.
SEE ALSO
See funtools(7) for a list of Funtools help pages
version 1.4.2 January 2, 2008 funopen(3)