Results 1 to 2 of 2

Thread: Looping with HTML tags

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Location
    India
    Posts
    12
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Looping with HTML tags

    Hi unix lovers out there,

    I Have a file that contains the following text in it,
    Code:
    ------------------------------------------------------------------------ r201535 | kashyapgiri@gmail.com| 2012-06-21 05:00:01 +0530 (Thu, 21 Jun 2012) |
     1 line Changed paths: M /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/RL.java Bug 63493 - J2ME : Pending Contact Count issue after SAS in Samsung 5230, Samsung b3410 
    URL:cor.airone/vv/AirOne/client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/RL.java ------------------------------------------------------------------------ r201572 | kashyapmanju@gmail.com | 2012-06-21 22:27:37 +0530 (Thu, 21 Jun 2012) |
     1 line Changed paths: M /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/resources.xml Error message has changed for invalid pin. 
    URL:cor.airone/vv/AirOne/client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/resources.xml
     ------------------------------------------------------------------------ r201575 | ngupta@gmail.com | 2012-06-21 22:45:06 +0530 (Thu, 21 Jun 2012) |
     1 line Changed paths: M /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/MB.java Samsung Wave S8500 UI changes 
    URL:cor.airone/vv/AirOne/client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/MB.java
     ------------------------------------------------------------------------
    The gaint task that lies in front of me is I need to edit each line of the file and format it into HTML output in order to send a mail.
    The major problem is the highlighted part should be represented as a link with the name THE LINK on clicking the link i should be able to go to the actual page.
    The output i need is as below,

    Code:
    ------------------------------------------------------------------------  r201535 | kashyapgiri@gmail.com| 2012-06-21 05:00:01 +0530 (Thu, 21 Jun  2012) |
     1 line Changed paths: M  /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/RL.java  Bug 63493 - J2ME : Pending Contact Count issue after SAS in Samsung  5230, Samsung b3410 
    THE LINK------------------------------------------------------------------------  r201572 | kashyapmanju@gmail.com | 2012-06-21 22:27:37 +0530 (Thu, 21  Jun 2012) |
     1 line Changed paths: M  /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/resources.xml  Error message has changed for invalid pin. 
    THE LINK
     ------------------------------------------------------------------------  r201575 | ngupta@gmail.com | 2012-06-21 22:45:06 +0530 (Thu, 21 Jun  2012) |
     1 line Changed paths: M  /client/j2me/cc/cool/v.0/j2me/src/main/java/com/airone/cclient/j2me/db/MB.java  Samsung Wave S8500 UI changes 
    THE LINK
     ------------------------------------------------------------------------
    The thing is even though "THE LINK" part is displayed same, it should take me to different pages based on the selection.
    Also i am allowed to place the remaining part of the file in a table or so.
    I hope i have explained my problem well.
    Please help me out in achieving this task.

    Thanks,
    Kashyap.

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    Hyderabad, AP, India
    Posts
    806
    Thanks
    44
    Thanked 55 Times in 48 Posts
    Rep Power
    12

    Default

    You can use below SED code to insert href codes..

    sed -r 's/(URL:.*\.java)/\<a href="\1"\>THE LINK\<\/a\>/g' html.txt

    html.txt is the file which have your logs and you have to include some basic title and body tags to this. I will leave that one to you..
    Thanks,
    Surendra Kumar Anne
    Linux: Fast, friendly, flexible and .... free!
    Support Open source.
    http://www.linuxnix.com

  3. The Following User Says Thank You to kumarat9pm For This Useful Post:

    kashyap (3rd January 2013)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 14th May 2011, 01:07 PM
  2. How to use sed to replace text between html tags
    By raj in forum Shell scripting
    Replies: 5
    Last Post: 11th May 2011, 02:59 PM
  3. [Solved] Read and replace text in html tags between 2 files
    By aixjadoo in forum Shell scripting
    Replies: 2
    Last Post: 13th December 2009, 05:20 PM
  4. [Solved] Looping through a shell script with Oracle sql statements
    By novice82 in forum Shell scripting
    Replies: 4
    Last Post: 9th October 2009, 07:40 AM
  5. Perl / Shell Regex to clean and remove all HTML tags
    By cosminnci in forum Coding in General
    Replies: 1
    Last Post: 27th January 2009, 01:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •