Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Converting text file to html page Post 303001722 by nextStep on Thursday 10th of August 2017 12:28:10 AM
Old 08-10-2017
HTML results in headers

Hi Corona688,

The code you gave to me was extremely useful .Now when i incorporated in the main script all the results are coming under the "Header" cell
Code:
Header                                                                      Filename  Timestamp
P	file1-en-us_US-20170718T150157Z.json Wed 19 Jul 2017 06:10:13 AM EDT
P	file2-en-us_US-20170718T150157Z.json Wed 19 Jul 2017 06:10:13 AM EDT
P	file3-en-us_US-20170718T150157Z.json Wed 19 Jul 2017 06:10:13 AM EDT

There is no change in the source file
Code:
P	file1-en-us_US-20170718T150157Z.json	Wed 19 Jul 2017 06:10:13 AM EDT
P	file2-en-us_US-20170718T150157Z.json	Wed 19 Jul 2017 06:10:13 AM EDT
P	file3-en-us_US-20170718T150157Z.json	Wed 19 Jul 2017 06:10:13 AM EDT

I have few functions above the given function as below.Could you please advise what needs to be modified to get the records in each Cell like earlier.

Code:
fn_parsepccanfrenchJson()
{
#echo "inside parse3"
arr=( $(find /home/aunnikrishnan/pccanfrench/json/ -type f -name "*.json" | cut -d '/' -f6-))
len=${#arr[@]}
IFS=! timearr=( $(find /home/aunnikrishnan/pccanfrench/json/ -type f -name "*.json" -printf '%Tc!' ) )
timeArray=(`echo ${timearr}`)
for ((i=0; i<$len; i++))
do
        appVersion=$(cat "/home/aunnikrishnan/pccanfrench/json/${arr[i]}"|jq '.' | grep "groupType" | awk -F ': ' '{print $2}' | sed 's/\"//g' | sed 's/ //g' | sed 's/,//')
        appArr=(`echo ${appVersion}`)

        UnixShell=("$appArr" "${arr[i]}" "$timeArray" )
        printf '%s\t%s\t%s\t\n' "${UnixShell[@]}"  >> pccanfrench.txt
done
}
#fn_parsepccanfrenchJson

#ILES="pcusaenglish.txt"
#FILES="timestamp.txt"

fn_html()
{
FILES="timestamp.txt"
echo "<html>
<style type='text/css'>
            table, th, td {
            border: 1px solid black;
            }
</style>
<body>
<table><tr><th>Header:</th><th>Filename:</th><th>TimeStamp:</th></tr>"

for FILE in $FILES
do
        while read H F D
        do
                printf "<tr>"
                printf "<td>%s</td>" "$H" "$F" "$D"
                printf "</tr>"
        done <$FILE
done

printf "</table></body></html>\n"
}
fn_html

[/QUOTE][/QUOTE]
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

linking unix generated text file to html page

i am trying to link the text files that i generated from my shell script to an html page, to that i can view them using a browser, like internet explorer. i want to open the text files in html page when i enter a command to view the text file from the shell command. please could anyone help... (1 Reply)
Discussion started by: alexd
1 Replies

2. UNIX for Dummies Questions & Answers

Converting HTML to CSV

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

3. UNIX for Dummies Questions & Answers

How do I extract text only from html file without HTML tag

I have a html file called myfile. If I simply put "cat myfile.html" in UNIX, it shows all the html tags like <a href=r/26><img src="http://www>. But I want to extract only text part. Same problem happens in "type" command in MS-DOS. I know you can do it by opening it in Internet Explorer,... (4 Replies)
Discussion started by: los111
4 Replies

4. Shell Programming and Scripting

Converting a text file to HTML

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

5. UNIX for Dummies Questions & Answers

Possible to download web page's text to a file?

Hi, Say there is a web page that contains just text only - that is, even the source code is just the text itself, nothing more. An example would be "http://mynasadata.larc.nasa.gov/docs/ocean_percent.txt" Is there a UNIX command that would allow me to download this text and store it in a... (1 Reply)
Discussion started by: Breanne
1 Replies

6. Shell Programming and Scripting

Converting columns of a text file.

Not sure the most effient way to do this. I have figiured out how to extract columns with shell script, but not sure how to convert This is what I have... NEWDNS 04-Jun-2011 06:00:59.762 10.220.136.217 crl.verisign.com This is what I need.... Change date, remove mil seconds,... (1 Reply)
Discussion started by: mrlayance
1 Replies

7. UNIX for Dummies Questions & Answers

Converting a text file with irregular spacing into a space delimited text file?

I have a text file with irregular spacing between values which makes it really difficult to manipulate. Is there an easy way to convert it into a space delimited text file so that all the spaces, double spaces, triple spaces, tabs between numbers are converted into spaces. The file looks like this:... (5 Replies)
Discussion started by: evelibertine
5 Replies

8. Shell Programming and Scripting

Converting text file in a matrix

Hi All, I do have a file with many lines (rows) and it is space delimited. For example: I have a file named SR345_pl.txt. If I open it in an editor, it looks like this: adfr A2 0.9345 dtgr/2 A2 0.876 fgh/3 A2 023.76 fghe/4 A2 2345 bnhy/1 A3 3456 bhy A3 0.9876 phy A5 0.987 kdrt A5... (9 Replies)
Discussion started by: Lucky Ali
9 Replies

9. Shell Programming and Scripting

Format problem while converting text file to csv

Hi , I need a help in following scenario.I tried searching in google but couldn't able to find the exact answer. Sorry if i am re-posting already answered query. While i am trying to convert into log file into csv i couldn't able to get the format which i am looking for. I converted file... (4 Replies)
Discussion started by: varmas424
4 Replies

10. Shell Programming and Scripting

Converting data for text file to csv

Gents Using the script attached (raw2csv). i use to create the file .csv.. The input file is called 201.raw. Kindly can you check if there is easy way to do it. The script works fine but takes a lot time to process Thanks for your help (8 Replies)
Discussion started by: jiam912
8 Replies
big5(5) 							File Formats Manual							   big5(5)

NAME
big5 - A character encoding system (codeset) for Traditional Chinese DESCRIPTION
The big5 codeset is one of several codesets that support the Traditional Chinese language. This codeset includes the following character sets: ASCII Big-5 The big5 codeset uses a combination of single-byte data and two-byte data to represent ASCII characters, symbols, and Chinese ideographic characters. ASCII Characters All ASCII characters are represented in the form of single-byte, 7-bit data in the big5 codeset; that is, the most significant bit (MSB) of a byte that represents an ASCII character is always set off. For more information, see ascii(5). Big-5 Character Groups The Big-5 character set defines the following character groups: Special symbols (408) Level 1 characters (5401) Level 2 characters (7652) Level 1 user-defined space (785) Level 2 user-defined space (2983) Level 3 user-defined space (2041) Code Values for Big-5 Characters Each Big-5 character is represented by a two-byte code that compiles according to the Big-5 standard. The MSB of the first byte is always set on while that of the second byte can be on or off. Code ranges for characters in the different character groups are as follows: Special symbols: A140 to A3BF Level 1 characters: A440 to C67E Level 2 characters: C940 to F9D5 Level 1 user-defined space: FA40 to FEFE Level 2 user-defined space: 8E40 to A0FE Level 3 user-defined space: 8140 to 8DFE In this space, the valid code range for the first byte is 81 to FE, while that for the second byte is 40 to 7E and A1 to FE. Codeset Conversion The following codeset converter pairs are available for converting Traditional Chinese characters between big5 and other encoding formats. Refer to iconv_intro(5) for an introduction to codeset conversion. For more information about the other codeset for which big5 is the input or output, see the reference page specified in the list item. dechanyu_big5, big5_dechanyu Converting from and to DEC Hanyu: dechanyu(5) dechanzi_big5, big5_dechanzi Converting from and to DEC Hanzi: dechanzi(5) eucTW_big5, big5_eucTW Converting from and to Taiwanese Extended UNIX Code: eucTW(5) sbig5_big5, big5_sbig5 Converting from and to Shift Big-5: sbig5(5) telecode_big5, big5_telecode Converting from and to Telecode: telecode(5) UCS-2_big5, big5_UCS-2 Converting from and to UCS-2: Unicode(5) UCS-4_big5, big5_UCS-4 Converting from and to UCS-4: Unicode(5) UTF-8_big5, big5_UTF-8 Converting from and to UTF-8: Unicode(5) Note The big5 encoding format is identical to the encoding format used in PC code pages that support Traditional Chinese. Therefore, you can use codeset converters that convert between big5 and UCS-2, UCS-4, or UTF-8 to convert Traditional Chinese data between PC code-page and Uni- code encoding formats. Refer to code_page(5) for a discussion of how the operating system supports PC code pages. Fonts for Big-5 Characters The operating system supports Big-5 code by internally converting characters to DEC Hanyu. Therefore, DEC Hanyu fonts are used for Big-5 characters. Both display and printer fonts are provided for DEC Hanyu and these are listed in the dechanyu(5) reference page. For general information about printer support for and codeset conversion of Asian text, refer to i18n_printing(5). SEE ALSO
Commands: locale(1) Others: ascii(5), Chinese(5), code_page(5), dechanyu(5), dechanzi(5), eucTW(5), GBK(5), i18n_intro(5), i18n_printing(5), iconv_intro(5), l10n_intro(5), sbig5(5), telecode(5), Unicode(5) big5(5)
All times are GMT -4. The time now is 04:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy