Preserve byte size of fields while pasting it to other file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Preserve byte size of fields while pasting it to other file
# 1  
Old 11-28-2009
Preserve byte size of fields while pasting it to other file

Hello
I want to set two fields in a text file to be of size 20.
how to do it using unix ?
eg: ABC.txt

Name | City

I want Name and City both to be of size 20.

Also If I am pasting it in other file the byte size should be preserved.i.e. If I want to append content of ABC.txt to other PQR.txt,
I shall use
paste -d'|' PQR.txt ABC.txt > tmp.tmp

Now
file tmp.tmp should reflect my ABC file content of size 20 each.

Seeking quick suggestions ...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

2. Shell Programming and Scripting

How to preserve spaces in input fields with awk?

I'm trying to do something pretty simple but its appears more complicated than expected... I've lines in a text file, separated by the comma and that I want to output to another file, without the first field. Input file: file1,item, 12345678 file2,item, 12345678 file2,item, ... (8 Replies)
Discussion started by: Armoric
8 Replies

3. Shell Programming and Scripting

Calculate byte size of string

Hi, I have task to merge multiple XML's to one big XML. In doing this i have to calculate the byte size of each XML which i will be recieving as a string from a code and append all the recieved XML's to single file. The reason being the byte size and the offset will help me to extract only... (7 Replies)
Discussion started by: chetan.c
7 Replies

4. Shell Programming and Scripting

reading files and pasting in another text file

Hi all, I have certain task to do, which involves reading the first column of 1.txt file. This is variable "event" 28434710 23456656 3456895 & finding this "event" in some other text file 2.txt, which has information in the following format #Zgamma: 1 run: 160998 event: ... (7 Replies)
Discussion started by: nrjrasaxena
7 Replies

5. UNIX for Dummies Questions & Answers

Pasting a column into a text file

I have two text files: One is a single column of numbers and the other is a space delimited text file with multiple columns. I want to paste the single column of numbers into the second column of the latter text file. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

data searching and pasting with in the file

Hi All, I have .csv file in which I am trying to manipulate a column date, I started with awk but i am not sure how to do the below logic in . the file has a 23 columns and in the first row if the value is Trend and in the second column the value is Analysis then the program has to... (3 Replies)
Discussion started by: shruthidwh
3 Replies

7. Shell Programming and Scripting

pasting fields from two files into one

i have two files with contents file a 1234,abcf 2345,drft 4444,befr file b tom,3 sam,5 dog,7 i want to print first column of file b and join to file a and get output as below tom,1234,abcf sam,2345,drft dog,4444,befr (2 Replies)
Discussion started by: dealerso
2 Replies

8. Shell Programming and Scripting

Preserve byte size of fields while pasting it to other file in unix

Preserve byte size of fields while pasting it to other file Hello I want to set two fields in a text file to be of size 20. how to do it using unix ? eg: ABC.txt Name | City I want Name and City both to be of size 20. Also If I am pasting it in other file the byte size should be... (1 Reply)
Discussion started by: dashing201
1 Replies

9. Shell Programming and Scripting

Check if 2 files are identical byte-to-byte?

In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server. For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match. Please... (4 Replies)
Discussion started by: krishmaths
4 Replies

10. UNIX for Dummies Questions & Answers

pasting text into an existing file

I have a text file that has over 300 lines that I need to paste identical data to. What is the easiest way to do this? For example if I have a file that has lines of text xxxxxxxx and I would like to change each line to look like this "display text(xxxxxxxx)". What would be the easiest way to do... (3 Replies)
Discussion started by: darthur
3 Replies
Login or Register to Ask a Question
MYSQLI_RESULT.FIELD_COUNT(3)						 1					      MYSQLI_RESULT.FIELD_COUNT(3)

mysqli_result::$field_count - Get the number of fields in a result

       Object oriented style

SYNOPSIS
int$mysqli_result->field_count () DESCRIPTION
Procedural style int mysqli_num_fields (mysqli_result $result) Returns the number of fields from 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). RETURN VALUES
The number of fields from a result set. 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(); } if ($result = $mysqli->query("SELECT * FROM City ORDER BY ID LIMIT 1")) { /* determine number of fields in result set */ $field_cnt = $result->field_count; printf("Result set has %d fields. ", $field_cnt); /* close result set */ $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(); } if ($result = mysqli_query($link, "SELECT * FROM City ORDER BY ID LIMIT 1")) { /* determine number of fields in result set */ $field_cnt = mysqli_num_fields($result); printf("Result set has %d fields. ", $field_cnt); /* close result set */ mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> The above examples will output: Result set has 5 fields. SEE ALSO
mysqli_fetch_field(3). PHP Documentation Group MYSQLI_RESULT.FIELD_COUNT(3)