Sponsored Content
Top Forums Shell Programming and Scripting Want to format column of a text file Post 302742933 by PikK45 on Tuesday 11th of December 2012 09:27:11 PM
Old 12-11-2012
Do you know the max_length of the first column?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Format a column of text

Hi I have a LONG ! column of text and I would like to format this into several columns. so from this abcd efgh ijkl mnop qrst uvwx yz12 to this abcd efgh ijkl mnop qrstu vwx yz12 (2 Replies)
Discussion started by: mlucas
2 Replies

2. Shell Programming and Scripting

How to print log file in column format using awk

Hi Friends, I have a log file as below siteid = HYD spc = 100 rset = RS_D_M siteid = DEL spc = 200 rset = RS_K_L siteid = DEL2 spc = 210 rset = RS_D_M Now I need a output like column wise as below. siteid SPC rset HYD 100 RS_D_M (2 Replies)
Discussion started by: suresh3566
2 Replies

3. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

4. Shell Programming and Scripting

Convert comma text file to Column in html format

I am trying to generate a report with below file : File1 : EQADM,edrtere9-phys,8122caef0,gpatmon,/bin/ksh,nuten Erick EQADM,edrtere11-phys,8227caef0,gpatmon,/bin/ksh,nuten Erick EQADM,edrtere3-phys,822caef0,gpatmon,/bin/ksh,nuten Erick can you help me convert it to html and add... (9 Replies)
Discussion started by: sriram003
9 Replies

5. Shell Programming and Scripting

format text file

i have a text file in this format: name1^A1^B1^ name2^A2^B2^ ... namex^Ax^Bx^ name1^AA1^ name2^AA2^ ... namex^AAx^ name1^AAA1^BBB1^ name2^AAA1^BBB2^ ... namex^AAAx^BBBx^ name1^AAAA1^ name2^AAAA2^ ... namex^AAAAx^ i want to generate a file: (2 Replies)
Discussion started by: busystock
2 Replies

6. Shell Programming and Scripting

Assigning a specific format to a specific column in a text file using awk and printf

Hi, I have the following text file: 8 T1mapping_flip02 ok 128 108 30 1 665000-000008-000001.dcm 9 T1mapping_flip05 ok 128 108 30 1 665000-000009-000001.dcm 10 T1mapping_flip10 ok 128 108 30 1 665000-000010-000001.dcm 11 T1mapping_flip15 ok 128 108 30... (2 Replies)
Discussion started by: goodbenito
2 Replies

7. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

I have a text file in the following format: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 13402 NA07019... (3 Replies)
Discussion started by: evelibertine
3 Replies

8. Shell Programming and Scripting

Convert the date format from mdy to ymd in column of file

The date format in the delimited file for one column '6/27/2011 12:00:00 AM' Is it possible o change it to '2011-06-27 12:00:00 AM' for all the records.. Thanks in advance..... (8 Replies)
Discussion started by: infernalhell
8 Replies

9. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

Hi, I have a text file in the following format: Code: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 ... (2 Replies)
Discussion started by: evelibertine
2 Replies

10. Shell Programming and Scripting

How to change the format of the date column in a flat file?

Hi, i have a flat file namely temp.txt with this data below ID|name|contact_date 101|Kay|2013-12-26 102|let|2013-12-26 I need to modify the date data in the flat file into MM/DD/YYYY HH24:MI:SS format let me know the code for this. Thank you! (5 Replies)
Discussion started by: srikanth_sagi
5 Replies
MYSQLI_FETCH_FIELD_DIRECT(3)						 1					      MYSQLI_FETCH_FIELD_DIRECT(3)

mysqli_result::fetch_field_direct - Fetch meta-data for a single field

       Object oriented style

SYNOPSIS
object mysqli_result::fetch_field_direct (int $fieldnr) DESCRIPTION
Procedural style object mysqli_fetch_field_direct (mysqli_result $result, int $fieldnr) Returns an object which contains field definition information from the specified result set. PARAMETERS
o $ result -Procedural style only: A result set identifier returned by mysqli_query(3), mysqli_store_result(3) or mysqli_use_result(3). o $fieldnr - The field number. This value must be in the range from 0 to number of fields - 1. RETURN VALUES
Returns an object which contains field definition information or FALSE if no field information for specified fieldnr is available. Object attributes +-----------+---------------------------------------------------+ |Attribute | | | | | | | Description | | | | +-----------+---------------------------------------------------+ | name | | | | | | | The name of the column | | | | | orgname | | | | | | | Original column name if an alias was specified | | | | | table | | | | | | | The name of the table this field belongs to (if | | | not calculated) | | | | | orgtable | | | | | | | Original table name if an alias was specified | | | | | def | | | | | | | The default value for this field, represented as | | | a string | | | | |max_length | | | | | | | The maximum width of the field for the result | | | set. | | | | | length | | | | | | | The width of the field, as specified in the table | | | definition. | | | | |charsetnr | | | | | | | The character set number for the field. | | | | | flags | | | | | | | An integer representing the bit-flags for the | | | field. | | | | | type | | | | | | | The data type used for this field | | | | | decimals | | | | | | | The number of decimals used (for numeric fields) | | | | +-----------+---------------------------------------------------+ EXAMPLES
Example #1 Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5"; if ($result = $mysqli->query($query)) { /* Get field information for column 'SurfaceArea' */ $finfo = $result->fetch_field_direct(1); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); $result->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, SurfaceArea from Country ORDER BY Name LIMIT 5"; if ($result = mysqli_query($link, $query)) { /* Get field information for column 'SurfaceArea' */ $finfo = mysqli_fetch_field_direct($result, 1); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> The above examples will output: Name: SurfaceArea Table: Country max. Len: 10 Flags: 32769 Type: 4 SEE ALSO
mysqli_num_fields(3), mysqli_fetch_field(3), mysqli_fetch_fields(3). PHP Documentation Group MYSQLI_FETCH_FIELD_DIRECT(3)
All times are GMT -4. The time now is 02:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy