Results 1 to 10 of 12
hello,
Can some one help me in this ?
i have 10 vi files . these files contain some system related information.
i need to combine the output of all ...
- 01-03-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 5
how do i show the output of several vi files in a single file and that
hello,
Can some one help me in this ?
i have 10 vi files . these files contain some system related information.
i need to combine the output of all these files into a single file.
the final file should contain contents of all these 10 files and the output should be in a tabular format.
is there any command in vi that i can use to create a table ?
Thanks
manali
- 01-03-2011 #2Just Joined!
- Join Date
- Dec 2010
- Location
- India
- Posts
- 45
there is no table command in vi editor
but u can get the output of all 10 files in one single file using script
u can use cat command and redirection operator(>) to get all 10 files in 1 single file but i am not very sure how it can be done in a tabular format
and in unix there is no vi files . vi is a editor in which we can open any text file .
- 01-04-2011 #3Just Joined!
- Join Date
- Mar 2005
- Location
- Corona, CA
- Posts
- 29
You could do:
file1 >>masterfile
file2 >>masterfile
file3 >>masterfile ...
don't know what you mean by "tabular" format, the above would just put one file after the next. If you want something fancier I'd learn how to use perl, then you could open each file and go line by line, manipulating whatever you wanted.
- 01-04-2011 #4Just Joined!
- Join Date
- Jun 2005
- Posts
- 28
Try using cat like this:
for files named 1,2,3,4, append the text to the end of the masterfile in the order named.
cat 1 2 3 4 >> masterfile
other than that perl is more effective
- 01-04-2011 #5Just Joined!
- Join Date
- Jan 2011
- Posts
- 5
Yup.. i was aware that we can use cat or use redirection symbol >> so that the content of all 10 files would be stored in a single file.
However this would cause cluttering of all the information in the result file.
So I wanted a way by which i can have rows and columns . a sample of what i expect is shown below:-
IP addr of machine 1 system information about machine1
IP addr of machine 2 system information about machine2
IP addr of machine 1 system information about machine3
and so on...
thanks
manali
- 01-04-2011 #6Just Joined!
- Join Date
- Dec 2010
- Location
- India
- Posts
- 45
In that case u can simply make a script
in which u will reaD ALL TEH FILES IN A LOOP
and just add what ever you want to echo
like
echo "system Info file1 " >> output file
cat file1 >> outputfile
- 01-04-2011 #7Just Joined!
- Join Date
- Jan 2011
- Posts
- 5
yes i have made a script that gets all the info...
the script is ready and works well.. i just want to present all the info in a presentable format.,, can u suggest me some way ?
- 01-04-2011 #8Just Joined!
- Join Date
- Dec 2010
- Location
- India
- Posts
- 45
i am not aware of your files what its doing and how you want to save them . and about prestable format you can first echo the name of the file ,
then the file contents and then simply put a line
like
echo "file info (information you want to put about file )" >> o/pfile
cat file1 >>o/p file
echo "-----------------------------" >> o/p file
- 01-04-2011 #9Just Joined!
- Join Date
- Apr 2010
- Posts
- 29
I hope You know the command cut
this command helps you to cut the words using delimiters. use this command in the script to cut the words and put it in a presentable form .
- 01-05-2011 #10Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
Do you wish to have 10 columns with a file in each column? Vi is a text editor it can create any text based file (C source, textual data, python code, etc). If you want the ten columns the "paste" command is used from the command line.
Code:paste file_1 file_2 ... file_10 > new_file


Reply With Quote