Sponsored Content
Full Discussion: Help with data formatting
Top Forums Shell Programming and Scripting Help with data formatting Post 302761579 by karumudi7 on Saturday 26th of January 2013 04:27:36 AM
Old 01-26-2013
IBM Help with data formatting

Hi,

I am generating the following output from my script.

Code:
Country,A,B,C,D,E,F
INDIA    ,3755019,774604,484749,329838,7333612,442031
CHINA       ,3716520,889197,530899,379754,6198475,355768
JAPAN       ,52038,30462,231224,147275,1272,498
USA,9494,1130,0,0,15303,451
UK,3680478,1085154,999262,645190,4453831,421336
CANADA      ,2,1,0,0,0,0
SINGAPORE         ,3548689,715416,1073298,733718,3520766,304011

I want to format this into html table code:

Code:
<table>
<tr><td>Country</td><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td><td>F</td></tr>
<tr><td>INDIA    </td><td>3755019</td><td>774604</td><td>484749</td><td>329838</td><td>7333612</td><td>442031</td></tr>
<tr><td>CHINA       </td><td>3716520</td><td>889197</td><td>530899</td><td>379754</td><td>6198475</td><td>355768</td></tr>
<tr><td>JAPAN       </td><td>52038</td><td>30462</td><td>231224</td><td>147275</td><td>1272</td><td>498</td></tr>
<tr><td>USA</td><td>9494</td><td>1130</td><td>0</td><td>0</td><td>15303</td><td>451</td></tr>
<tr><td>UK</td><td>3680478</td><td>1085154</td><td>999262</td><td>645190</td><td>4453831</td><td>421336</td></tr>
<tr><td>CANADA      </td><td>2</td><td>1</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
<tr><td>SINGAPORE         </td><td>3548689</td><td>715416</td><td>1073298</td><td>733718</td><td>3520766</td><td>304011</td></tr>
</table>

Also Bold the first column (Country names) and first row (Column names).
But here I have to handle cases if the output from the initial script gives one more extra country.

I want to use this final output for UNIX mail command with HTML. So the body of the message will display a table for this.

Thanks.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Formatting Data

i am writing a script that reads in a file and i just want it to print each element on a new line here is my code and the data that i want to read in #!/usr/bin/perl use strict; use CGI qw(:standard); use CGI qw(:cgi); my $data_file = "/tmp/results.txt"; my $configuration; my... (3 Replies)
Discussion started by: nmeliasp
3 Replies

2. Shell Programming and Scripting

Re-formatting of data display

Hi All, I have been trying to re-arrange the below data using AWK or Perl. Can anybody help me ? Thanks in advance. Input: 111 222 333 444 AAA BBB CCC DDD 555 666 777 888 EEE FFF GGG HHH Output: (6 Replies)
Discussion started by: Raynon
6 Replies

3. Shell Programming and Scripting

Script for data formatting

Hi I have to convert the data in a file ******* 01-20-09 11:14AM 60928 ABC Valuation-2009.xls 01-20-09 11:16AM 55808 DEF GHI Equation-2009.xls 01-20-09 11:02AM 52736 ABC DF Valuation-2009.xls 01-20-09 11:06AM 89600 THE... (6 Replies)
Discussion started by: shekhar_v4
6 Replies

4. UNIX for Dummies Questions & Answers

Data manipulation/ formatting question

How would I get this output to look $ cat newfile 13114 84652 84148 LIKE THIS?: 13114,84652,84148 sed,cut awk? syntax? (2 Replies)
Discussion started by: ddurden7
2 Replies

5. Shell Programming and Scripting

Formatting Data - CSV

I want to check whether if any column data has any + , - , = prefixed to it then convert it in such a form that in excel its not read as formula. echo "$DATA" | awk 'BEGIN { OFS="," } -F" " {print $1,$2,$3,$4,$5,$6,$7,$8.$9,$10,$11,$12}' (4 Replies)
Discussion started by: dinjo_jo
4 Replies

6. Shell Programming and Scripting

Formatting input data

Hello everybody, I have a file containing some statistics regarding CPU usage. The file has this syntax : Fri Jul 16 14:27:16 EEST 2010 Cpu(s): 15.2%us, 1.4%sy, 0.0%ni, 82.3%id, 0.1%wa, 0.0%hi, 0.9%si, 0.0%st Fri Jul 16 15:02:17 EEST 2010 Cpu(s): 15.3%us, 1.4%sy, 0.0%ni, 82.3%id, ... (9 Replies)
Discussion started by: spiriad
9 Replies

7. Shell Programming and Scripting

help with data formatting

Hi, I have data coming in like below. Not all data is like that, these are the problem records that is causing the ETL load to fail. Can you pls help me with combining theese broken records! 001800018000000guyMMAAY~acct name~acct type~~"address part 1 address... (8 Replies)
Discussion started by: varman
8 Replies

8. UNIX for Advanced & Expert Users

formatting the data

HI I want to make it single row if start with braces i.e. { .Any idea {1:XXX2460275191}{2:SEC00687921131112201641N}{3:{58910}}{4: :R:GENL :C::xx//xx1 :20C::yy//yy1 :2S:xxT} {1:XXX2460275190}{2:SEC00687921131112201641y}{3:{58911}}{4: :z:GENL :v::xx//xx1 :10C::yy//yy1 :4S:xxT ... (2 Replies)
Discussion started by: mohan705
2 Replies

9. Shell Programming and Scripting

Data formatting using awk

Need assistance on the data extraction using awk Below is the format and would like to extract the data in another format ------------------------------------------------------------------------------------------------- Minimum Temperature (deg F ) DAY 1 2 3 4 5 6 7 8 9 10 11... (4 Replies)
Discussion started by: ajayram_arya
4 Replies
MGD77INFO(1gmt) 					       Generic Mapping Tools						   MGD77INFO(1gmt)

NAME
mgd77info - Get information about MGD77[+] files SYNOPSIS
mgd77info NGDC-ids [ -C[m|e] ] [ -E[m|e] ] [ -Iignore ] [ -Mf[item]|r|e|h ] [ -L[v] ] [ -V ] DESCRIPTION
mgd77info reads <legid>.[mgd77|nc] files and produces a single record of information about each cruise specified. The information includes beginning and end times, total track distances in km, longitude and latitude range, and the total number of geophysical observations. Optionally, choose instead to see the original MGD77 header meta-data section or its individual members. If you need to know which tracks are crossing through a given region and what kinds of geophysical observations are available, consider using the x2sys tools to set up a tracks index data base (see x2sys_init for more information). NGDC-ids Can be one or more of five kinds of specifiers: 1) 8-character NGDC IDs, e.g., 01010083, JA010010etc., etc. 2) 2-character <agency> codes which will return all cruises from each agency. 3) 4-character <agency><vessel> codes, which will return all cruises from those vessels. 4) =<list>, where <list> is a table with NGDC IDs, one per line. 5) If nothing is specified we return all cruises in the data base. (See mgd77info -L for agency and vessel codes). The ".mgd77" or ".nc" extensions will automatically be appended, if needed (use -I to ignore certain file types). Cruise files will be looked for first in the current directory and second in all directories listed in $MGD77_HOME/mgd77_paths.txt [If $MGD77_HOME is not set it will default to $GMT_SHAREDIR/mgd77]. OPTIONS
No space between the option flag and the associated arguments. -C List abbreviations for all columns present in the MGD77[+] files. Append m or e to limit the display to the MGD77 standard or MGD77+ extended set only. -E Give a one-line summary for each cruise listed. -M List the meta-data (header) and (if present) the MGD77+ history for each cruise. Append f for a formatted display. This will list individual parameters and their values, one entry per output line, in a format that can be searched using standard UNIX text tools. Alternatively, append the name of a particular parameter (you only need to give enough characters - starting at the beginning - to uniquely identify the item). Give - to display the list of all parameter names. You may also specify the number of a parameter. For the raw, punchcard-formatted MGD77 original header block, append r instead. For the MGD77+ E77 status, append e instead. Finally, for the MGD77+ history, append h instead. -I Ignore certain data file formats from consideration. Append a|c|t to ignore MGD77 ASCII, MGD77+ netCDF, or plain tab-separated ASCII table files, respectively. The option may be repeated to ignore more than one format. [Default ignores none]. -L No cruise information is listed. Instead, we just display a list of the GEODAS institution 2-character codes and their names. Optionally, append v to also display the vessels and their 4-character codes for each institution. The following is the list of institutions:(01) LAMONT (LDEO), (02) WOODS HOLE O.I., (03) NOAA, (04) US ARMY, (05) NEW ZEALAND, (06) US GEOL. SURVEY, (07) OREGON ST. UNIV, (08) U.HAWAII SOEST, (09) US NAVY, (10) UNIV OF TEXAS, (11) RICE UNIV., (12) CANADA, (13) UNIV OF CONN., (14) U.MIAMI (RSMAS), (15) SCRIPPS INST.OC, (16) CHINA, (17) U RHODE ISLAND, (18) DUKE UNIVERSITY, (19) UNITED KINGDOM, (20) U.WASHINGTON, (22) WESTERN GEO- PHY., (23) TEXAS A&M UNIV., (24) AUSTRALIA, (25) MONACO, (29) RUSSIA, (30) SPAIN, (35) NIMA, (58) NETHERLANDS, (60) MIN MGMT SVC, (63) ISRAEL, (67) FRANCE, (71) SOUTH AFRICA, (75) US COAST GUARD, (76) BRAZIL, (77) INT. GRAV. BUR, (83) GERMANY, (84) ORSTOM NEW CAL, (86) CUBA, (87) ARGENTINA, (88) US NSF, (89) INDIA, (90) PORTUGAL, (92) FINLAND, (93) CHILE, (J1) HYDR DEPT JAPAN, (J2) GEOL SRVY JAPAN, (J4) UNIV TOKYO, (J5) KOBE UNIV, (J7) UNIV OF RYUKYUS, (J8) J.O.D.C. JAPAN, (J9) CHIBA UNIV, (JA) INST.POLAR RES., (ZZ) INST NOT CODED. -V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. EXAMPLES
To get one-line summary information about the cruises 01010047.mgd77 and 01010008.mgd77, try mgd77info 01010047 01010008 -E > listing.lis To see the original raw MGD77 header meta-data for cruise 01010047.mgd77, run mgd77info 01010047 -Mr To determine all the parameters related to Gravity during cruise 01010047.mgd77, run mgd77info 01010047 -Mf | grep Gravity To determine the Magnetic sampling rate used during cruise 01010047.mgd77, run mgd77info 01010047 -MfMagnetics_Sampling_Rate To see all the columns that the MGD77+ cruise 01010047.nc contains, run mgd77info 01010047 -C To see the E77 status of all MGD77+ cruises collected by the University of Hawaii, run mgd77info 08 -Ia -Me SEE ALSO
mgd77list(1), mgd77manage(1), mgd77path(1), mgd77track(1) x2sys_init(1) REFERENCES
Wessel, P., and W. H. F. Smith, 2011, The Generic Mapping Tools (GMT) version 4.5.7 Technical Reference & Cookbook, SOEST/NOAA. Wessel, P., and W. H. F. Smith, 1998, New, Improved Version of Generic Mapping Tools Released, EOS Trans., AGU, 79(47), p. 579. Wessel, P., and W. H. F. Smith, 1995, New Version of the Generic Mapping Tools Released, EOS Trans., AGU, 76(33), p. 329. Wessel, P., and W. H. F. Smith, 1995, New Version of the Generic Mapping Tools Released, http://www.agu.org/eos_elec/95154e.html, Copyright 1995 by the American Geophysical Union. Wessel, P., and W. H. F. Smith, 1991, Free Software Helps Map and Display Data, EOS Trans., AGU, 72(41), p. 441. The Marine Geophysical Data Exchange Format - "MGD77", see http://www.ngdc.noaa.gov/mgg/dat/geodas/docs/mgd77.txt GMT 4.5.7 15 Jul 2011 MGD77INFO(1gmt)
All times are GMT -4. The time now is 04:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy