Write column

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Write column
# 1  
Old 06-26-2017
Write column

Hello,

I looking for a simple way to write into a file in column, e.g:

I've a file contains below:
Code:
1

And I wish add another number from another command something like this:

Code:
1 2

I hope have been clear. I would be able to display these values but I cannot write Smilie

Regards,

Arnaud
# 2  
Old 06-26-2017
Hello Arnaudh78,

No, it is not at all clear, we could write a program to add numbers into columns but question is what should be the criteria to do so?

Kindly add useful sample Input_file(with proper testing sample) and with proper expected output sample too in code tags.

Thanks,
R. Singh
# 3  
Old 06-26-2017
Hmm. Try awk:

Code:
awk '{printf("%s 2\n") }' infile  >newfile
# validate newfile before you execute this next line
mv newfile infile   # clobbers the original file

This is likely not what you need, but it does answer your question, just as you asked. As RavinderSingh13 already pointed out. Good detailed questions get you good answers.
This User Gave Thanks to jim mcnamara For This Post:
# 4  
Old 06-27-2017
Sorry for the response delay, I used an another way but apparently it helped other,

Thanks !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is it possible to write write multiple cronjobs in shellscript??

Hi All, I need the answer of below question? 1) How to write multiple cronjobs in shellscript? Is there any way or we cant write in shellscript... Regards, Priyanka (2 Replies)
Discussion started by: pspriyanka
2 Replies

2. Shell Programming and Scripting

Get the average from column and write the value at the last field

Dear Experts, Kindly help me please to get the average from column 14 and to write the value at the last field., But we need to take as reference the column 16., example the first 4 lines has the same value in column 16, therefore I want ot get the average only for these lines in column 14. And... (2 Replies)
Discussion started by: jiam912
2 Replies

3. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

4. UNIX for Dummies Questions & Answers

Count the lines with the same values in a column and write the output to a file

Hey everyone! I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column. my input file is like this: ID1 1 10M AAATTTCCGG ID2 5 4M ACGT ID3 5 8M ACCTTGGA ID4 5 ... (7 Replies)
Discussion started by: @man
7 Replies

5. Shell Programming and Scripting

How to write to different files based on a column

Hi, I have the following sample file 32895901-d17f-414c-ac93-3e7e0f5ec240 AND @GDF_INPUT 73b129e1-1fa9-4c0d-b95b-4682e5389612 AUS @GDF_INPUT 40f82e88-d1ff-4ce2-9b8e-d827ddb39447 BEL @GDF_INPUT ffbcc6fe-ba35-489c-ae08-e70e8897aa23 BEL @FF_INPUT... (3 Replies)
Discussion started by: ramky79
3 Replies

6. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

7. Shell Programming and Scripting

Help need to write a script on column separation for syslog output in perl

HI Pros, I have a issue.I need to write a script to parse the logs got from syslog server and update the same in my database.I need the following output.I donot know perl and I heard it very easy to write in perl I have the sample log I need each column seperated by commas and all equals... (0 Replies)
Discussion started by: iron_michael86
0 Replies

8. Shell Programming and Scripting

Changing one column of delimited file column to fixed width column

Hi, Iam new to unix. I have one input file . Input file : ID1~Name1~Place1 ID2~Name2~Place2 ID3~Name3~Place3 I need output such that only first column should change to fixed width column of 15 characters of length. Output File: ID1<<12 spaces>>Name1~Place1 ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies

9. Shell Programming and Scripting

Write a new value to a column in AWK

I have a file with columns which are separated by tabs and spaces like 111 333 444 555 7gg 333 555 678 778 6yy I need to write a AWK commmand , to search for a pattern in column 1 eg "111" and replace the value in column 5 with say "7kk" , I tried the assignment... (4 Replies)
Discussion started by: prav076
4 Replies

10. Shell Programming and Scripting

How to write data in column

I Have Two Files, A And B. How Can I Rewrite Them Into A New File With The Following Pattern? File A 123 456 789 File B 235 478 987 Become 123 235 456 478 987 789 Thanks In Advance!! (8 Replies)
Discussion started by: c0384
8 Replies
Login or Register to Ask a Question