0

Hello and thank you for any help you can provide

I have my Apache2 web server set up so that when I go to a specific link, it will run and display the output of a shell script stored on my server. I need to output the results of an SVN command (svn log). If I simply put the command 'svn log -q' (-q for quiet), I get the output of:

(of course not blurred), and with exactly 72 dashes in between each line. I need to be able to take these dashes, and turn them into an html line break, like so:

<br />

Basically I need the shell script to take the output of the 'svn log -q' command, search and replace every chunk of 72 dashes with an html line break, and then echo the output.

Is this at all possible? I'm somewhat a noob at shell scripting, so please excuse any mess-ups.

Thank you so much for your help.

1
  • 2
    Do you really hate <pre> that much? Commented Jul 27, 2011 at 22:12

2 Answers 2

2
 svn log -q | sed -e 's,-{72},<br/>,'
Sign up to request clarification or add additional context in comments.

3 Comments

I tried putting it into my shell script exactly like this and nothing was printed on the page. Any other suggestions? Thanks for your help.+
There should not be quotes around svn log -q. @Bohemian, hope you don't mind if I edit to fix…
There are differences in sed syntax. Instead of guess which syntax yours supports, try svn log -q | perl -pe 's,^-{72}$,<br/>,'
0

If you want to write it in the script this might help:

${string//substring/replacement}
Replace all matches of $substring with $replacement.

stringZ=abcABC123ABCabc

echo ${stringZ/abc/xyz}       # xyzABC123ABCabc
                              # Replaces first match of 'abc' with 'xyz'.

echo ${stringZ//abc/xyz}      # xyzABC123ABCxyz
                              # Replaces all matches of 'abc' with # 'xyz'.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.