Create a table - very new to unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Create a table - very new to unix
# 1  
Old 07-19-2010
Create a table - very new to unix

I need to create a simple table of information by grepping several columns from various files and display them all at once with simple headers on top. Can anyone help get me started? I am very new to unix so I really have no idea how to work with this and I appreciate any help I can get! Let me know if any additional information is necessary. Thanks again!
# 2  
Old 07-19-2010
We need sample inputs(files) and expected output.
# 3  
Old 07-19-2010
Hi.

At least you've heard of grep, so that's a start Smilie

What would be useful is, if you could provide a "working example" of the data you have, the files they are in, what data and columns you expect to "grep", and manipulate, what the headings should be, and where that information might come from, and how the result should be presented.

Otherwise, it might take hours, and we'd have to license the answer to you!

i.e
Code:
$ cat Headings
H1 H2 H3 H4

$ cat Data1
a 1
b 2
a 2
c 3

$ cat Data2
a 6
b 11
d 9

$ .... some code later....
H1 H2 H3 H4
9  13 3  9

# 4  
Old 07-19-2010
Code:
$ cat  Headings
Location  Lat  Long  Time  ID  Mon

I need the location from file jg.table, which has the following info: lat and long are the fourth and fifth columns, and time is the last column.

Code:
1611400 Nawiliwili  Hawaii  21.955 -159.357    1.5271 1955-2006
1612340 Honolulu    Hawaii  21.307 -157.867    1.4984 1905-2006
1612480 Mokuoloe    Hawaii  21.437 -157.793    1.3076 1957-2006
1615680 Kahului     Hawaii  20.898 -156.472    2.3161 1947-2006
1617760 Hilo        Hawaii  19.730 -155.057    3.2686 1927-2006

Then I need the ID and mon from the list Cmonu.list in which the id is the first part and the mon is the information following it:
Code:
ANP1-Ground,Pillar
ANP2-Ground,Pillar
AOML-Ground,Pillar
ARP3-Ground,Pillar
AV09-Ground,Braced
BARH-Roof,Middle
BRMU-Roof,Middle

Let me know if this isn't what you're looking for or if you need anything else!

Last edited by Scott; 07-19-2010 at 03:11 PM.. Reason: Added more code tags
# 5  
Old 07-19-2010
Question Commonality between two files

Perhaps I am missing something, but I did not see anything 'common' between the two file examples. Or, perhaps, I just did not understand how you reference between the 2 files.

And, what is the desired output?
# 6  
Old 07-19-2010
I'm not sure what you mean by common, but those are just two separate files that I need to get info from and put into one single table like this:

Code:
Location               Lat     Long      Time        ID    Mon
Nawiliwili Hawaii      21.955  -159.357  1955-2006   ANP1  Ground,Pillar


Last edited by Scott; 07-19-2010 at 03:14 PM.. Reason: Please use code tags
# 7  
Old 07-19-2010
so, the files line up line-for-line?

The 1st line of jg.table links to 1st line of cmonu.lst?
And the 2nd line to 2nd line?
And so on?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create table within awk-if statement

Hi I am trying to create a table within an awk if statement awk -F, '{ if ($8 ~ /Match/) BEGIN{print "<table>"} {print "<tr>";for(i=1;i<=NF;i++)print "<td>" $i"</td>";print "</tr>"} END{print "</table>"}' SN1.csv | mailx -s "Your details" abc@123.com But this doesnt work.. Please suggest (8 Replies)
Discussion started by: sidnow
8 Replies

2. Shell Programming and Scripting

Create table using tbl command

Hi, I required the output like attached: I tried using the below command and i'm getting error: file with data: .TS box; cB s s c|c|c PO Download statistics - Host to SOM Time;Receive Time;Processing Time;PO count 4.30 AM OMHPO File;Tue Feb 21 04:39:55 EST 2012;Tue Feb... (3 Replies)
Discussion started by: cns1710
3 Replies

3. Shell Programming and Scripting

Create Script from table

I have a table ABC with 4 columns and below data Col1,Col2,Col3,Col4 prod,10,12,joba prod,10,11,jobb qa,10,12,jobc I want to create an output file like this Server:prod StartTime:10 EndTime:12 JobName:joba Server:prod StartTime:10 EndTime:11 JobName:jobb (3 Replies)
Discussion started by: traininfa
3 Replies

4. Shell Programming and Scripting

Create Pivot table

I would like to use awk to parse a file with three columns in, like: Chennai,01,1 Chennai,07,1 Chennai,08,3 Chennai,09,6 Chennai,10,12 Chennai,11,19 Chennai,12,10 Chennai,13,12 Kerala,09,2 AP,10,1 AP,11,1 Delhi,13,1 Kerala,13,3 Chennai,00,3 Chennai,01,1 Chennai,02,1 Chennai,07,5 (3 Replies)
Discussion started by: boston_nilesh
3 Replies

5. UNIX and Linux Applications

create table via stored procedure (passing the table name to it)

hi there, I am trying to create a stored procedure that i can pass the table name to and it will create a table with that name. but for some reason it creates with what i have defined as the variable name . In the case of the example below it creates a table called 'tname' for example ... (6 Replies)
Discussion started by: rethink
6 Replies

6. Shell Programming and Scripting

Create table

Hi I want create table based on csv file .I have come up with some informations getting columns names and then no idea from that .Please any help file.txt col1|col2|col3|col4|col5 1234|zxxxx|xcvvv|300|null file.sh file=$1 c1=`head -1 $file|tr "|" "\n" |cat -n` echo "$c1"... (31 Replies)
Discussion started by: mohan705
31 Replies

7. Shell Programming and Scripting

to create an output file as a table

Hi, I have four input files and would like to create an output file as a table. Please check the example below. File 1. 111111 222222 333333 444444 File 2. 555555 666666 777777 888888 File 3. aaaaa bbbbb ccccc ddddd (2 Replies)
Discussion started by: marcelus
2 Replies

8. Shell Programming and Scripting

How to create a C structure using table description.

There is table 'DEPT' in the database with the following desciption: Name Null? Type ------- -------- ------------------------ DEPTNO NOT NULL NUMBER(2) DNAME NULL VARCHAR2(14) LOC NULL VARCHAR2(13) Using shell script, I need to create a structure for the... (2 Replies)
Discussion started by: ehari
2 Replies

9. Shell Programming and Scripting

create new table/field

Dear Folks, If I have 2 files, say A and B in format: A: $1 $2 01032 12856 01041 13351 01042 11071 01042 12854 01042 12862 01042 12866 . . . and B: (2 Replies)
Discussion started by: Gr4wk
2 Replies

10. Shell Programming and Scripting

MySql: create table error

Hi, iam learning MySql. Iam trieing to create a table in the database "guestbook" at the command line in mysql heres what i type but i get a error mysql>create table guestbook ->( -> name varchar(40) null. -> url varchar(40) null. -> comments ... (3 Replies)
Discussion started by: perleo
3 Replies
Login or Register to Ask a Question