Forum Home
Press F1
 
Thread ID: 23969 2002-08-31 00:46:00 Linux command to put file o/p into columns Nigel Thomson (629) Press F1
Post ID Timestamp Content User
75158 2002-08-31 00:46:00 Greetings from the sun kissed deep south.
As part of an assignment
Question One
I have to read in three files, in which the fields are seperated by commas, remove the duplicate fields, and output the result into an output file with the fields seperated by tabs.
I have done this, but the problem i am having is that as a few of the fields are longer than the length of the tab setting some rows are out by one tab stop.
below is the command I used

paste filea fileb filec | tr , '\t' | cut -f2,34,6 >resultFile

I am wondering if it is possible to increase the width of tab stops within this command, or if there is a similar command that will put the output into some form of table.

Next Question
I need to display alist of users who are currently logged in, to the screen the only info I need is the user name (f1), once again I have a solution or two listed here

1)users
2)who | cut -f1 -d ' '
the o/p format i want is a list down the left hand side of the screen which the second one gives me, but I think there should be a way to do this using the users command

thank you for any help, and sorry about the length of my post
nigel
ps is there a good linux website that will show dos commands and there linux equivalent as well as being in plain english
Nigel Thomson (629)
75159 2002-08-31 03:56:00 Have a look at the Linux Cookbook (dunedin.lug.net.nz), say, Part 3. sed is a very useful text stream editor.
Awk and Perl are also useful.

What happens if you pipe the tr after the cut? pr might have some options you could use ...
Graham L (2)
1