How do I sort data in column properly?

Can i use ' column ' command to get the required 3rd column output?

Input example:

1 2 345678 90
2 2 356       42
3 3 8265     55

Output required:

1 2 345678 90
2 2      356  42
3 3    8265  55

Basically i want the 3rd column to be justified to the right, instead of left. ' >>column -t ' command somehow makes it skewed to the left.

Thank you:)

Welcome to the forum.

How about

rev file | column -t | rev
1  2  345678  90
2  2     356  42
3  3    8265  55

Be aware that this will right justify every column.

1 Like

Thank you very much RudiC:). Now, how do i output it into the new file?

What new file? There is no mention of a new file in post #1 in this thread?

What shell are you using?

What operating system are you using?

For many shells on many operating systems, the command:

rev oldfile | column -t | rev > newfile

would reformat the contents of a file named oldfile into a new file named newfile .

1 Like