PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, August 18, 2022

[FIXED] How to convert terminal output to HTML file format

 August 18, 2022     aix, ansi, ansible, html, output     No comments   

Issue

I was using "ansi2html.sh" here http://www.pixelbeat.org/scripts/ansi2html.sh to get my job done.

ls -lrt /web/htdocs | tail -12 | ./ansi2html.sh --bg=dark >test.html

I was using ansible on local host having Linux OS to run this across multiple hosts which generated the html files on each of the remote hosts and then i would finally pull all the html files from all remote to my local ansible server.

This worked fine for all Linux systems.

However, "ansi2html.sh" has dependency of gawk which is not present on a set of production AiX 6.1 and 7 system.

I get this error:

./ansi2html.sh[38]: gawk:  not found

As my AiX is hosting the production application; installing gawk is not recommended.

I dont know if the solution could be to get the output of ls -lrt from all AiX host and then feed that output to "ansi2html.sh" on the local ansible linux server having gawk. Not sure if this will work and if so how ? Note: i wish the output to have the same look and feel as on the putty terminal prompt.

Can I get a solution for AiX so i could use ansible to get html files with the output of ls -lrt from across all AiX hosts ?


Solution

(Already written as comment) You can use ssh to execute a command on the remote computer and process the output on the local computer. Example:

ssh user@aixhost 'ls -lrt /web/htdocs | tail -12' |
./ansi2html.sh --bg=dark >test.html

Standard input can be redirected, too, e.g:

ssh user1@host1 'cd frompath; tar -czf - sendme/' |
ssh user2@host2 'cd topath; tar -xzf -'

Note: I know nothing about Ansible, but I heard that with it you can do almost everything you could do without it.



Answered By - Lorinczy Zsigmond
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing