Thanks for the really quick reply, Corona. I have several lines in the "some text here" paragraph. Number of lines in that may vary. The above code is putting only the last line into the row. The only thing constant is my number of lines before "some text here" (before blank line) ie 9. Probably what I need is to pick up 9 lines after header and put it into a row and rest of the text it into another row.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
I like the flexibility of awk, but I find that the code tends to be very specific, and not as general as I would like -- as General George Patton said I don't like to pay for the same real estate twice. meaning that I don't like to solve similar problems all over again.
So I look for tools that can help more generally. In this case, I found one that transforms text into HTML, and it knows how to recognize tables: txt2html.
However, the input is structured in blocks vertically:
and I think it is more useful to have them appear horizontallly:
and that's an easy job (in this situation) for csplit to create a number of files, and then paste to align them side-by-side. Then we can augment the pieces with sed to conform to one of the table type formats.
Here is the script and result:
producing:
See the attachment f2.html and man pages.
That was fairly straight-forward. If one can use perl, then a host of other possibilities arise. The approach can be similar, with statements storing data in rows, but more custimization can be done. I find that perl code is far more likely to be generalizable, and so can handle option processing, which is not a strength of awk (although it can be done).
Hi Experts,
Anybody out there figure out on how to achieve in shell scripts or tools. I have done googling to find solutions but no luck.
I have thousands of .txt files to batch process, please see the below sample text content after -------- start here --------. What I want to achieve is to... (10 Replies)
hi i hav a file called focus. which is the output file. i want to convert this file to html file and mail it. help with code and explanatio. i am basic in unix (7 Replies)
thanks for allowing me to join your forum
i have a html file with three columns ------------Last visit date , URL and link,,,,,,,, how can i convert the same into csv so that i can output into database... the mechine is linux...i made a little googling and got idea that there is ways for... (2 Replies)
is there anyway i can paste/cat a text file into a html paragraph <p>
function html_header
{
cat <<END
<html>
<head><title>${1}</title></head>
<body>
<p>
${2}
</p>
END
}
function html_footer
{
cat <<END
</body>
</html>
END (2 Replies)
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)
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)
Dear Sir;
i want to know how the binary data convert to text file or readablw format (ASCII).If possible pl. help me for the software and where it is available for download. i.e. (1 Reply)
I am having a problem. There is one ISAM file available in SCO UNIX environment. I want to convert it to simple comma delimited text file. Actual problem is with the size of the file. For the time being, size is 1.3 GB and I have to grab the subset of the data after every five minutes e.g. in... (3 Replies)