Expanding shell variables directly within a printf format string is a bad idea; it sh it can lead to unpredictable behavior (in C, it's a serious security hole) if something in those variables resembles a format specifier (%s, %d, %%, etc).
No offense, but I cannot be bothered to analyze your output and reverse engineer the values of your variables.
You should show us the code you are using in its entirety or at the very least print out the value of each variable for each line of output. Then the actual output for those values followed by the desired output.
Regardless of any of the above, your format will be wrecked if any string exceeds its alloted width unless the format specifier truncates it by specifying a precision. In case it's illuminating compare this ...
against this ...
If your output format must accommodate fields of unpredictable widths, and if you are unwilling to truncate them, then you must resort to inspecting all of the output, storing it in the meantime, and then dynamically generating a format string which can accommodate the widest value in each column.
This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Hi , I have below command to that outputs from variables..
command:
echo $INSTANCE $DATAB $status $TSLastBackup| awk '{printf("%-8s %-8s \t \n",$1,$2,$3,$4)}' | tee $LOGF
the ouput is now:
INSTANCE DATABSE BACKUP_STATUS BACKUPTIMESTAMP
------- -------- -------- ... (1 Reply)
Hi
I need to assign the ouput of a awk statement to two variables; below is a example of the txt file i have which I use awk against
sample file
testval,USA,loc2,testing02
testval1,GB,loc4,testing01
awk statement
awk -F , '{print $2,$3}'
USA loc2
GB loc4
I need a method where... (6 Replies)
Hello Experts,
Below is the record i have:
sample data attached
I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows
Can you help me , it will be... (10 Replies)
Hello,
I would like to ask for help with csh script.
An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that... (7 Replies)
I would like to join two files when two columns in each file matches with each other and then produce an output when taking multiple columns.
Like I have file A
1234,ABCD,23,JOHN,NJ,USA
2345,ABCD,24,SAM,NY,USA
5678,GHIJ,24,TOM,NY,USA
5678,WXYZ,27,MAT,NJ,USA
and file B
... (2 Replies)
I have several problems with my problems: I hope you can help me.
1) the If else statement I am getting an error message. My syntax must be incorrect because the entire statement is throwing an error.
For example in filew.log if these items don't exist Memsize, SASFoundation and also if... (0 Replies)
Discussion started by: dellanicholson
0 Replies
LEARN ABOUT PHP
px_create_fp
PX_CREATE_FP(3)PX_CREATE_FP(3)px_create_fp - Create a new paradox databaseSYNOPSIS
bool px_create_fp (resource $pxdoc, resource $file, array $fielddesc)
DESCRIPTION
Create a new paradox database file. The actual file has to be opened before with fopen(3). Make sure the file is writable.
Note
Calling this functions issues a warning about an empty tablename which can be safely ignored. Just set the tablename afterwards with
px_set_parameter(3).
Note
This function is highly experimental, due to insufficient documentation of the paradox file format. Database files created with this
function can be opened by px_open_fp(3) and has been successfully opened by the Paradox software, but your milage may vary.
PARAMETERS
o $pxdoc
- Resource identifier of the paradox database as returned by px_new(3).
o $file
-File handle as returned by fopen(3).
o $fielddesc
- fielddesc is an array containing one element for each field specification. A field specification is an array itself with either
two or three elements.The first element is always a string value used as the name of the field. It may not be larger than ten
characters. The second element contains the field type which is one of the constants listed in the table Constants for field
types. In the case of a character field or bcd field, you will have to provide a third element specifying the length respectively
the precesion of the field. If your field specification contains blob fields, you will have to make sure to either make the field
large enough for all field values to fit or specify a blob file with px_set_blob_file(3) for storing the blobs. If this is not
done the field data is truncated.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Creating a Paradox database with two fields
<?php
if(!$pxdoc = px_new()) {
/* Error handling */
}
$fp = fopen("test.db", "w+");
$fields = array(array("col1", "S"), array("col2", "I"));
if(!px_create_fp($pxdoc, $fp, $fields)) {
/* Error handling */
}
px_set_parameter($pxdoc, "tablename", "testtable");
for($i=-50; $i<50; $i++) {
$rec = array($i, -$i);
px_put_record($pxdoc, $rec);
}
px_close($pxdoc);
px_delete($pxdoc);
fclose($fp);
?>
SEE ALSO px_new(3), px_put_record(3), fopen(3).
PHP Documentation Group PX_CREATE_FP(3)