Write column

Hello,

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

I've a file contains below:

1

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

1 2

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

Regards,

Arnaud

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

Hmm. Try awk:

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.

1 Like

Sorry for the response delay, I used an another way but apparently it helped other,

Thanks !