Computing.Net > Forums > Unix > Script to insert lines in a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script to insert lines in a file

Reply to Message Icon

Name: sandeep
Date: May 7, 2003 at 22:16:21 Pacific
OS: HP-UX
CPU/Ram: p2
Comment:

Hello all,
I have wriiten a script to create a html file on the fly. It is as shown below :-

1>echo " " > log.html
2>cat test.log >> log.html
3>echo " " >> log.html
The log.html file puts the test.log in html format so that it can seen from a browser. The problem is @ line 2. The file test.log is huge & it looks very clumpsy in the log.html (when seen from the browser).

Cud u guys suggest some way in which i can
insert line break tag in between every line in log.html. It can be either when the file is being created (cat test.log >> log.html) or after the log.html file is created.

The log.html file should look like :-







Sponsored Link
Ads by Google

Response Number 1
Name: sandeeprk
Date: May 7, 2003 at 22:43:51 Pacific
Reply:

the last few lines r missing. so i thought i 'll just add it.

The log.html file shud look like
HTML
BODY
CONTENTS OF test.log
br ----------- this is break line in html
CONTENTS OF test.log
br
CONTENTS OF test.log
br
BODY
HTML


0

Response Number 2
Name: David Perry
Date: May 8, 2003 at 04:41:12 Pacific
Reply:

What you would like then is for each line of test.log to be terminated with in addition to the line feed.

sed -e 's,$,BR,' test.log >> log.html

This forum strips the less than tag. Please wrap the BR in less than and greater than marks.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


sla login: screen Any UNIX Buying Advise?



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Script to insert lines in a file

Script to Remove lines from a file www.computing.net/answers/unix/script-to-remove-lines-from-a-file/5268.html

Script to delete lines from a file www.computing.net/answers/unix/script-to-delete-lines-from-a-file/7408.html

how to replace a line in a file www.computing.net/answers/unix/how-to-replace-a-line-in-a-file/7214.html