0

I am trying to insert some HTML code for my Telldus script page. I want create a link-image. I have tried a lot of different alternatives for this code but nothing works.

AWK CODE to generate off.php

# awk '{print a$1b$1d}' a='<a href="' b='-off.html">' d='<img src='OFF.png'></a><br> ' off1.php > off.php

Result for off.php

# more off.php
<a href="Lampor-off.html">Lampor<img src=OFF.png></a><br>

Result I want for off.php

<a href="Lampor-off.html"><img src=OFF.png></a>Lampor<br>

So, I want the image to be a link instead of the word "Lampor".

3
  • 1
    Please post sample Input and expected output more clearly as it is not clear. Commented May 13, 2017 at 14:40
  • What's the purpose of variables like a='<a href="' instead of just hard-coding the fixed values in the print statement? Commented May 13, 2017 at 16:18
  • generating html with awk is weird ... pretty weird Commented May 13, 2017 at 16:23

1 Answer 1

1

this should do...

awk '{print "<a href=\""$1"-off.html\""><img src=OFF.png></a>"$1"<br>"}' file
Sign up to request clarification or add additional context in comments.

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.