By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,879 Members | 1,809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,879 IT Pros & Developers. It's quick & easy.

probles with space between two words, HTML

P: 19
Hello,

I have one weather.txt file:

city weatther

Amsterdam mostly cloudy
Zagreb havy reain

...

I am using this code to convert it ti html and add table:

cat weather.txt |awk 'BEGIN { print "<html>"
print "<table BORDER=2>"}
{ print "<tr>"
print "<td>"
print $1
print "</td>"
print "<td>"
print $2
print "</td>"
print "<td>"
print $3
print "</td>"
print "<td>"
print $4
print "</td>"
print "<td>"
print $5
print "</td>"
print "<td>"
print $6
print "</td>"
print "<td>"
print $7
print "</td>"
print "<td>"
print $8
print "</td>"
print "<tr>"
print "</html>"}

END { print "</table>"
print "</html>"}'
Problem is: if I have space between words it separate it to two colimns or two rows, but I wont to have it in column or row. How can I solve this problem?

Thenks a lot
Mar 10 '08 #1
Share this Question
Share on Google+
1 Reply


drhowarddrfine
Expert 5K+
P: 7,435
Are you saying awk is creating a new cell for the second word when there is a space? In that case, you need to ask how to change that on the Unix forum.
Mar 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.