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.
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.
Last edited by kchinnam; 03-13-2016 at 07:21 PM..
Reason: corrected input
The pathnames of the files in all three of the lists have exactly six components where the 1st component is of the form jardigits.suffix where digits is a string of one or more decimal digits and suffix is either jar or war; the second, third, fourth, and fifth components are the same in all of the pathnames; and the sixth component is of the form filedigits2.class where digits2 is another string of one or more decimal digits.
The first component in the pathnames will not have the same digits string for both a .jar directory name and a .war directory name.
Even though the <ul> HTML tag might be misplaced in some groups, an </ul> HTML tag will always appear on the first line after the lines containing the <li> HTML tags for each table.
And, the <li> HTML tag always appears at the start of a line.
the following works with your provided sample input:
As always, if you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
Don,
I have corrected my input. I only need to sort on first column(i.e .jar/.war names) sort -t/ -k1 is working fine.
This code is printing only lines start with "<li>", how can I keep html around it?
output is divided into three groups: Added/Removed/Changed. Could you try to keep these?
Don,
I have corrected my input. I only need to sort on first column(i.e .jar/.war names) sort -t/ -k1 is working fine.
This code is printing only lines start with "<li>", how can I keep html around it?
output is divided into three groups: Added/Removed/Changed. Could you try to keep these?
In the code I suggested:
the 1 shown in red at the end of the awk code prints the lines that you say are not being printed. I can only assume that you did not copy that part of my suggestion into the code you used.
With your new requirements, the line in my suggestion:
can be simplified to just:
With this change to my suggestion and your new sample input, the output produced is:
which seems to meet your requirements.
This User Gave Thanks to Don Cragun For This Post:
Note that awk statements take the form:
where condition is evaluated for each input line and, if it yields a value of TRUE or a non-zero numeric value or a non-empty string string value, the actions specified by action will be performed for that input line. If no condition is specified, the given action will be performed for every line. If condition is specified and no action is given, print the input line if condition evaluates to true.
Does this answer your questions?
Last edited by Don Cragun; 03-13-2016 at 10:35 PM..
Reason: Fix typo: s|/li>|/ul|
This User Gave Thanks to Don Cragun For This Post:
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)
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)
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)
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)
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)
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)
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)
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)
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)