Results 1 to 1 of 1
I'm working on cgi+bash script. I am unable to print the contents of a file in proper format on webpage i.e. with proper line breaks.
The snippet below has provided ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-18-2010 #1
Formatting issue - CGI/BASH
I'm working on cgi+bash script. I am unable to print the contents of a file in proper format on webpage i.e. with proper line breaks.
The snippet below has provided me only 60% success
(some of lines were display as expected and the other were combined with previous line). I would like to know if there is anyway that I can
provide "visible" line breaks on the webpage while displaying the content. Or if possible add a line (-------------------)
after every newline.
the file starts with few letters in CAPS then '|' sign, hence i have used ^[A-Z]\.Code:NO_OF_LINES=`wc -l filename | cut -d' ' -f1` for i in `seq 1 $NO_OF_LINES`; do LINE=`cat filename | sed -n "$i s/\(^[A-Z]\|.*\)/\1/p" | sed 'G;G'` echo "$LINE" done
any help would be appreciated.


Reply With Quote
