Sponsored Content
Top Forums Shell Programming and Scripting Sort html based on .jar, .war file names and still keep text within three groups. Post 302968667 by kchinnam on Saturday 12th of March 2016 09:19:47 PM
Old 03-12-2016
Sort html based on .jar, .war file names and still keep text within three groups.

Output from zipdiff GNU EAR comparison tool produces output in html divided into three sections "Added, Removed, Changed". I want the output to be sorted by jar or war file.


Code:
<html>
<body>
<table>
<tr>
<td class="diffs" colspan="2">Added </td>
</tr>
<tr><td>
<ul>
<li>jar1.jar/com/aaa/bbbb/cc/file1.class</li>
<li>jar1.jar/com/aaa/bbbb/cc/file3.class</li>
<li>jarname.jar/com/aaa/bbbb/cc/dd/filename.class</li>
<li>jarname.jar/com/aaa/bbbb/cc/ee/af/fileblala.class</li>
</ul>
<tr>
<td class="diffs" colspan="2">Removed </td>
</tr>
<tr><td>
<ul>
<li>jar3.war/com/aaa/bbbb/cc/file5.class</li>
<li>jarbla.jar/com/aaa/bbbb/cc/file6.class</li>
<li>jarblabla.war/com/aaa/bbbb/cc/ee/fa/afd/filenamefa.class</li>
<li>jar3.war/com/aaa/bbbb/cc/affa/faf/wrw/filenaa.class</li>
</ul>
<tr>
<td class="diffs" colspan="2">chagned </td>
</tr>
<ul>
<tr><td>
<li>jar4.jar/com/aaa/bbbb/cc/filefsaf.class</li>
<li>jarfsadf.war/com/aaa/bbbb/cc/filedfasf.class</li>
<li>jar4.jar/com/aaa/bbbb/cc/file11.class</li>
<li>jardfasdf.war/com/aaa/bbbb/cc/rr/ryy/filedfasf.class</li>
</ul>
</td>
</tr>
</table>

Expected output will have sorted by .jar and .war file names under sections
"Added, Removed, Updated". I think awk or sed can do this with inline replacing.

Code:
<html>
<body>
<table>
<tr>
<td class="diffs" colspan="2">Added </td>
</tr>
<tr><td>
<ul>
<li>jar1.jar/com/aaa/bbbb/cc/file1.class</li>
<li>jar1.jar/com/aaa/bbbb/cc/file3.class</li>
<li>jarname.jar/com/aaa/bbbb/cc/dd/filename.class</li>
<li>jarname.war/com/aaa/bbbb/cc/ee/af/fileblala.class</li>
</ul>
<tr>
<td class="diffs" colspan="2">Removed </td>
</tr>
<tr><td>
<ul>
<li>jar3.war/com/aaa/bbbb/cc/file5.class</li>
<li>jar3.war/com/aaa/bbbb/cc/affa/faf/wrw/filenaa.class</li>
<li>jarbla.jar/com/aaa/bbbb/cc/file6.class</li>
<li>jarblabla.war/com/aaa/bbbb/cc/ee/fa/afd/filenamefa.class</li>
</ul>
<tr>
<td class="diffs" colspan="2">chagned </td>
</tr>
<ul>
<tr><td>
<li>jar4.jar/com/aaa/bbbb/cc/filefsaf.class</li>
<li>jar4.jar/com/aaa/bbbb/cc/file11.class</li>
<li>jarfsadf.war/com/aaa/bbbb/cc/filedfasf.class</li>
<li>jardfasdf.war/com/aaa/bbbb/cc/rr/ryy/filedfasf.class</li>
</ul>
</td>
</tr>
</table>


Last edited by kchinnam; 03-13-2016 at 07:21 PM.. Reason: corrected input
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I extract text only from html file without HTML tag

I have a html file called myfile. If I simply put "cat myfile.html" in UNIX, it shows all the html tags like <a href=r/26><img src="http://www>. But I want to extract only text part. Same problem happens in "type" command in MS-DOS. I know you can do it by opening it in Internet Explorer,... (4 Replies)
Discussion started by: los111
4 Replies

2. UNIX for Dummies Questions & Answers

How can I sort the file names in the directory

Hi , I have a list of files in the directory I want to sort based on the file name. But in the middle of filename contains the number based on that I need to sort.Could you suggest me on the same? Example filenames: /user1$ls RS.DEV.ISV.F1.RS.REFDATA.DATA... (1 Reply)
Discussion started by: praveen.thumati
1 Replies

3. Shell Programming and Scripting

Find and rename long file names (html)

Hi Guys, I need a help. I have 1130 zip files. Each one of them has files including 1 html file with long file name (includes special charactors, Alphabetic and numbers). I have copied all 1130 zip files to my linux system and extracted using below command. Find . -name "*.zip" -exec... (7 Replies)
Discussion started by: Rajmani
7 Replies

4. Shell Programming and Scripting

Sort content of text file based on date?

I now have a 230,000+ lines long text file formatted in segments like this: Is there a way to sort this file to have everything in chronological order, based on the date and time in the text? In this example, I would like the result to be: (19 Replies)
Discussion started by: KidCactus
19 Replies

5. UNIX for Dummies Questions & Answers

gawk asort to sort record groups based on one subfield

input ("/" delimited fields): style1/book1 (author_C)/editor1/2000 style1/book2 (author_A)/editor2/2004 style1/book3 (author_B)/editor3/2001 style2/book8 (author_B)/editor4/2010 style2/book5 (author_A)/editor2/1998 Records with same field 1 belong to the same group. Using asort (not sort),... (3 Replies)
Discussion started by: lucasvs
3 Replies

6. Web Development

Sort 3 or more columns in a HTML file

Hi Friends, I have a HTMl file with 10 columns. I found a script online that can sort any single column in a HTML file. But, I would like to sort on multiple columns at once. Could you please show some pointers? Thanks (6 Replies)
Discussion started by: jacobs.smith
6 Replies

7. Shell Programming and Scripting

How to get CRC check sum of files in java EAR file without extracting .jar/.war files to disk.?

unzip -v gives CRC info of each file in a zip(in my case .EAR) file. # unzip -v my-application.ear Archive: my-application.ear Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 197981 Defl:N 183708 7%... (1 Reply)
Discussion started by: kchinnam
1 Replies

8. Shell Programming and Scripting

Best way to sort file with groups of text of 4-5 lines by the first one

Hi, I have some data I have taken from the internet in the following scheme: name direction webpage phone number open hours menu url book url name ... Of course the only line that is mandatory is the name wich is the one I want to sort by. I have the following sed & awk script that... (3 Replies)
Discussion started by: devmsv
3 Replies

9. UNIX for Beginners Questions & Answers

Sort a text file based on names in square brackets

Hi all, I have a text file similar to this: Text More text Etc Stuff That Is Needed Etc Etc This contains over 70 entries and each entry has several lines of text below the name in square brackets. (5 Replies)
Discussion started by: Scally
5 Replies
REBUILD-JAR-REPOSI(1)						Java Packages Tools					     REBUILD-JAR-REPOSI(1)

NAME
rebuild-jar-repository - rebuild a JAR repository SYNOPSIS
rebuild-jar-repository [OPTION]... DIRECTORY DESCRIPTION
Rebuild a jar repository (built by build-jar-repository) based on the current JVM settings OPTIONS
If no option is specified the default action will be to rebuild with symbolic links -c, --copy Copy files. -h, --hard Create hard links. -s, --soft, --symbolic Create symbolic links (default). EXAMPLES
rebuild-jar-repository . - This will update all links created by build-jar-repository in the current working directory. Updated links will be symbolic links. rebuild-jar-repository -h /tmp - This will update all links created by build-jar-repository in the /tmp directory. Updated links will be hard links. AUTHOR
Written by the JPackage Project (http://www.jpackage.org/). REPORTING BUGS
Bugs should be reported through Red Hat Bugzilla at http://bugzilla.redhat.com/. SEE ALSO
build-jar-repository(1), build-classpath(1), JAVAPACKAGES
06/10/2014 REBUILD-JAR-REPOSI(1)
All times are GMT -4. The time now is 07:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy