Linux shell txt convert to HTML implementation code _linux shell

Source: Internet
Author: User

Principle: awk command, split formatted TXT (TXT file format with "|") divided) into groups, then spliced into HTML format (html-head-title-body-table)

Shell Source

#!/bin/sh file_input= ' txt.log ' file_output= ' txt2html.html ' td_str= ' function Create_html_head () {echo-e '  

TXT format for test:

Angry birds| Arcade & action|4.6|887,058|10,000,000-50,000,000| free| August, 2011|1.6.3|19m|1.6 and up| Low maturity Angry Birds seasons| Arcade & action|4.5|314,060|10,000,000-50,000,000| free| September 1, 2011|1.6.0|22m|1.6 and up| Low maturity Bunny shooter free game| Brain & puzzle|4.9|121,579|1,000,000-5,000,000| free| September 7, 2011|1.06|8.6m|2.1 and up| Low maturity Angry Birds rio| Arcade & action|4.7|310,324|10,000,000-50,000,000| free| August, 2011|1.3.0|17m|1.6 and up| Everyone Words with Friends free| Brain & puzzle|3.7|312,017|10,000,000-50,000,000| free| September 1, 2011| Varies with device| Varies with device|2.1 and up| Everyone tetris®free| Brain & puzzle|3.8|1,288|500,000-1,000,000| free| September 1, 2011|1.0.27|8.7m|1.6 and up| Low Maturity Drag Racing| racing|4.5|150,279|10,000,000-50,000,000| free| September 9, 2011|1.1.3|6.5m|1.6 and up| Everyone Drunk man| racing|3.6|2,388|1,000,000-5,000,000| free| September 2, 2011|1.2.1|998k|1.5 and up| EvEryone solitaire| Cards & casino|4.3|83,548|10,000,000-50,000,000| free| December, 2010|1.12.2|83k|1.0 and up| Everyone Dragon, fly!| Arcade & action|4.6|46,790|1,000,000-5,000,000| free| September 3, 2011|1.8|3.2m|1.6 and up| Low maturity pimple popper| Arcade & action|2.7|3,014|1,000,000-5,000,000| free| September 8, 2011|1.8|2.2m|2.0 and up| Low maturity Fruit Ninja free| Arcade & action|4.5|13,915|1,000,000-5,000,000| free| August 4, 2011|1.6.2.10|18m|2.1 and up| Low Maturity Fruit slice| Arcade & action|4.5|165,603|10,000,000-50,000,000| free| September, 2011|1.3.2|4.0m|1.6 and up| Everyone Prize claw| Arcade & action|3.9|1,102|500,000-1,000,000| free| September 2, 2011|1.1|13m|2.0.1 and up| Everyone 3D Bowling| Arcade & action|4.0|14,794|5,000,000-10,000,000| free| June, 2011|1.3|9.8m|2.0.1 and up| Everyone 7 Little words| Brain & puzzle|4.8|21,073|500,000-1,000,000| free| August, 2011|1.00|3.2m|2.2 and up| Everyone Third blade| Arcade & action|4.3|6,475|500,000-1,000,000| free| September 9, 2011|1.0.2|49m|1.6 and up| Medium Maturity Shoot Bubble deluxe| Arcade & action|4.2|11,645|5,000,000-10,000,000| free| May, 2011|2.5|1.1m|1.1 and up| Everyone Racing moto| Arcade & action|4.4|79,829|1,000,000-5,000,000| free| August, 2011|1.1.2|3.9m|1.6 and up| Everyone Zynga poker| Cards & casino|4.6|91,976|1,000,000-5,000,000| free| August 31, 2011| Varies with device| Varies with device|2.0.1 and up| Medium Maturity

Generated HTML:

Shell implementation txt conversion to HTML (source download)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.