04-22-2008
Try this awk
awk 'BEGIN{
FS="|"
print "<HTML><BODY><TABLE border=1>"
}
{
printf "<TR>"
if(i=1)
printf "<TD ALIGN=\"LEFT\" width=\"100\" height=\"25\"><font size=\"2\" face=\"Verdana\"><b>%s</font></b></TD>", $i
if(i=2)
printf "<TD ALIGN=\"LEFT\" width=\"300\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=3)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=4)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=5)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
if(i=6)
printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i
}
END{
print "</TABLE></BODY></HTML>"
}
' file.txt >> file1.xls
****** i-- has number of records
******delimiter is " |"
it's return XLS files and open in windows.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi, I need to convert a relatively large html file (1.5megs) into CSV under Unix. How would I be able to do this?
Much thanks. (3 Replies)
Discussion started by: Jexel
3 Replies
2. Shell Programming and Scripting
Hi,
Im new to shell scripting. My task is to convert shell script feed into html, so basically I have a lot of information in shell script and I want to convert it html. I know you can simply convert the information by hand, but is there any simpler way? Thank you
Dave (3 Replies)
Discussion started by: davwel
3 Replies
3. Shell Programming and Scripting
Hi,
I need to convert a text file formatted like this ("tshark -z conv,ip" output) to HTML:
=====================================================================================================
IPv4 Conversations
Filter:<No Filter>
| <- ... (4 Replies)
Discussion started by: ph0enix
4 Replies
4. Shell Programming and Scripting
Hi All,
I have a requirement of converting an html form into pdf using perl.
The html form contains images, tables and css implementation. I tried using various perl modules but failed to achive the target.
I succeeded in generating a pdf from the html file using... (2 Replies)
Discussion started by: DILEEP410
2 Replies
5. Shell Programming and Scripting
Hi,
Basically what I am trying to do is the following.
I have created a shell script to grab timetabling information from a website using curl then I crop out only the data I need which is a table based on the current date. It leaves me with a file that has the table I want plus a small amount... (2 Replies)
Discussion started by: domsmith
2 Replies
6. Shell Programming and Scripting
I have a spreadsheet in a folder that looks like this:
Sector1...Sector2...Sector3...Sector4...Sector5...Sector6...Sector7
SomeID....Title.......SomeID...SomeID....SomeID...SomeID....SomeID
OtherID...MyTitle....SomeID...SomeID....SomeID...SomeID....SomeID... (7 Replies)
Discussion started by: Xterra
7 Replies
7. Shell Programming and Scripting
I'm pulling down some LUN usage data once per day. I store the data in a file name that matches the name of the LUN. Then I just append new usage amounts to the same file each day.
Filename might be serv01_luna, serv01_lunb, serv01_lunc, etc, etc.
Inside the file it would like the following... (7 Replies)
Discussion started by: dwcasey
7 Replies
8. Shell Programming and Scripting
Below is the code I have - How can I convert the data in the csv into 3 tables in html. instead of 1 table.
Attached is the format I am getting. (1 Reply)
Discussion started by: archana25
1 Replies
9. UNIX for Beginners Questions & Answers
Hello Everyone,
I have the following text file with the each field separated by newline
Text file
P
file1-en-us_US-20170718T150157Z.json
Wed 19 Jul 2017 06:10:13 AM EDT
P
file2-en-us_US-20170718T160150Z.json
Wed 19 Jul 2017 06:10:13 AM EDT
P
file3-en-us_US-20170718T163218Z.json
Wed... (9 Replies)
Discussion started by: nextStep
9 Replies
10. Shell Programming and Scripting
Hello everybody, :)
I need some help with a school project that I have to create for the next week. :eek:
So first, the aim of the Script is that I have a WebSite with a lot of .html / .shtml / .js / .css in one directory. That directory have few directory too but that's not so important,... (1 Reply)
Discussion started by: mariocrocop
1 Replies
PSC(1) General Commands Manual PSC(1)
NAME
psc - prepare sc files
SYNOPSIS
psc [-fLkrSPv] [-s cell] [-R n] [-C n] [-n n] [-d c]
DESCRIPTION
Psc is used to prepare data for input to the spreadsheet calculator sc(1). It accepts normal ascii data on standard input. Standard out-
put is a sc file. With no options, psc starts the spreadsheet in cell A0. Strings are right justified. All data on a line is entered on
the same row; new input lines cause the output row number to increment by one. The default delimiters are tab and space. The column for-
mats are set to one larger than the number of columns required to hold the largest value in the column.
OPTIONS
-f Omit column width calculations. This option is for preparing data to be merged with an existing spreadsheet. If the option is not
specified, the column widths calculated for the data read by psc will override those already set in the existing spreadsheet.
-L Left justify strings.
-k Keep all delimiters. This option causes the output cell to change on each new delimiter encountered in the input stream. The
default action is to condense multiple delimiters to one, so that the cell only changes once per input data item.
-r Output the data by row first then column. For input consisting of a single column, this option will result in output of one row
with multiple columns instead of a single column spreadsheet.
-s cell
Start the top left corner of the spreadsheet in cell. For example, -s B33 will arrange the output data so that the spreadsheet
starts in column B, row 33.
-R n Increment by n on each new output row.
-C n Increment by n on each new output column.
-n n Output n rows before advancing to the next column. This option is used when the input is arranged in a single column and the
spreadsheet is to have multiple columns, each of which is to be length n.
-d c Use the single character c as the delimiter between input fields.
-P Plain numbers only. A field is a number only when there is no imbedded [-+eE].
-S All numbers are strings.
-v Print the version of psc
SEE ALSO
sc(1)
AUTHOR
Robert Bond
PSC 7.16 19 September 2002 PSC(1)