Sponsored Content
Top Forums Shell Programming and Scripting Help with showing the difference in two lines of input Post 302167311 by rein on Thursday 14th of February 2008 04:26:44 AM
Old 02-14-2008
In Python try this:

Code:
from sets import Set
a = Set([1,2,3,4,5,6,80,90])
b = Set([1,2,3,4,5,80,90])
for i, v in enumerate(a^b):
	print v

>>> 6
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

word count showing wrong number of lines

Hi , I am using SUN OS Version 5.6. I have a file that contains records of length 270. when I do 'set nu' in vi editor, I get the count as 86. whereas when I do "wc -l" on the command prompt, it shows the count as only 85. this is very strange. why would the 'wc' show 1 record less. The job... (3 Replies)
Discussion started by: tselvanin
3 Replies

2. UNIX for Dummies Questions & Answers

counting lines and showing the output

First time poster - I have a huge file and i want to sort and compress it to something more readable Ex: FUTNCA01-SL1 DMT8a4 5 3 FUTNCA01-SL1 DMT8a4 5 9 FUTNCA01-SL1 DMT8a4 5 21 FUTNCA01-SL1 DMT8a4 5 22 FUTNCA01-SL1 DMT8a4 5 23 FUTNCA01-SL1 DMT8a4 5 24 FUTNCA01-SL1 DMT8a4 6 2... (13 Replies)
Discussion started by: jjoves
13 Replies

3. UNIX for Dummies Questions & Answers

awk help in calulating difference for last two lines

Hi all, I have a requirement for a script to find out the increase in memory. We have a log native_stderr.log where this will log. bash-2.05$ tail -40 native_stderr.log | grep ': freed' <GC(4140): freed 168190456 bytes, 66% free (180990488/271776256), in 253 ms> <GC(4141): freed... (4 Replies)
Discussion started by: senthilkumar_ak
4 Replies

4. Shell Programming and Scripting

difference between 1 st fields from consicutive lines

13608:End of Tests. 13811:End of Tests. 14014:End of Tests. 14217:End of Tests. 14420:End of Tests. 14623:End of Tests. 14826:End of Tests. 15029:End of Tests. 15232:End of Tests. 15435:End of Tests. 15638:End of Tests. i have file like above. i want difference betwwn first field of... (2 Replies)
Discussion started by: pankajd
2 Replies

5. Shell Programming and Scripting

Showing the first 4 lines of a file?

Is there a way to show the first 4 lines of a file without using head -4? In sed would it be sed '1,4d' ? What if I just wanted to display the 2nd line ONLY? How could this be done with AWK?...correctly with SED? (6 Replies)
Discussion started by: puttster
6 Replies

6. Shell Programming and Scripting

Help with script or command to differentiate difference between two input file?

I got two file write now. Input file 1: >data_1 DSFDFDSGFDSGSGEGTRTRERPOYIORPGKKGDSPKFSDKFPSDKFSPFS >data_34 WEEREREWREWOIQOPIEPDSKLFNDSFNSKNCASKJHDAFHAOUDFEOWWIOUFEWIUEWIRUEWIRUEWIORUEWOREWR >data_21 ASDASDQWEQWRQERFWPOTGIUWEIPOFIOFDSNFKSJDNFSKDHFKDSJHFKDSJHF >data_4... (14 Replies)
Discussion started by: perl_beginner
14 Replies

7. Shell Programming and Scripting

Perl : code on ping showing difference result

Hi all, I am using the below code to ping a code and print whehter the connection is successful or not. use Net::Ping; $p = Net::Ping->new(); my $host = "x.x.x.x"; # print "$host is alive.\n" if $p->ping($host); if ($p->ping($host,3)) { print... (0 Replies)
Discussion started by: scriptscript
0 Replies

8. Shell Programming and Scripting

What is difference between this two lines in script?

Hi Guys, What is difference between this two lines in script logger -p daemon.info -t postback Starting /opt/local/bin/backup-report and /opt/local/bin/backup-report is the backu script running twice here? Thanks, (2 Replies)
Discussion started by: manalisharmabe
2 Replies

9. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies

10. Shell Programming and Scripting

Calculate time difference between two lines

i grepped the time stamp in a file as given below now i need to calculate time difference file data: 18:29:10 22:15:50 (5 Replies)
Discussion started by: vivekn
5 Replies
SGMLDIFF(1)															       SGMLDIFF(1)

NAME
sgmldiff - Find differences in the markup of two SGML files SYNOPSIS
sgmldiff [ options ... ] file1 file2 [ -a | --attributes | -c [ attributes | nesting | textpos ] | --context [ attributes | nesting | textpos ] | -s | --statistics | -h | --help | -v | --version ] DESCRIPTION
This perl script allows to determine the structural differences between two SGML files. It compares the files, regardless of what is in between the tags, to only focus on the markup. Its output is similar to diff(1). The typical use of sgmldiff is to compare an SGML file with its translation into another language. If the translation was done cleanly, sgmldiff returns without finding any difference in the markup. An example of a typical call to sgmldiff is: sgmldiff english.sgml italiano.sgml If there are differences in markup between both files, sgmldiff will output a series of differences reports summarized with lines of the form: 169a164 At line 169 of the first file, line 164 of the second file has been added. 8a12,15 At line 8 of the first file, lines 12 to 15 of the second file have been added. 41d28 Line 41 of the first file has been destroyed, to obtain line 28 of the second file. 63,66d61 Lines 63 to 66 of the first file have been destroyed. to obtain line 61 of the second file. 52c51 Line 52 of the first file has been changed into line 51 of the second file. 5,7c8,10 Lines 5 to 7 of the first file have been changed into lines 8 to 10 of the second line. In addition to those summaries, the lines of the first file are shown preceeded by '<' and the lines of the second file are shown preceeded by '>". OPTIONS
Here is the list of actions that can be requested to sgmldiff: [ -a | --attributes ] Include the attribute values in the difference tests. Don't set this value if the attributes are likely to be translated. Set this value if the attributes value shouldn't change between both files. Default is to don't include the attributes in the difference tests. [ -c [ attributes | nesting | textpos ] | --context [ attributes | nesting | textpos ] ] Add more context to the difference. Since every test between the tags is removed before testing the differences, sgmldiff is likely to resynchronize itself at the wrong place, by thinking the location in both files correspond, while it's not true. By adding more context to the compared area, such risk is disminished. The allowed values for the --context option are: attributes Take into account the attribute names. The attribute values are controlled by the attributes option. nesting Take into account the nesting level of all the compared tags. textpos Take into account the position in the text. [ -s | --statistics ] Print some SGML information at the end. [ -h | --help ] Print a short help message and exit [ -v | --version ] Print the version identifier and exit FILES
AUTHORS
Frederik Fouvry Developer of sgmldiff. SEE ALSO
jw(1) conversion from a SGML file to other file formats nsgmls(1) a base component of Jade DSSSL engine http://sources.redhat.com/docbook-tools/ <URL:http://sources.redhat.com/docbook-tools/> the home page of the DocBook tools, a compendium of all tools necessary to process DocBook files, including the DocBook-utils 11 February 2004 SGMLDIFF(1)
All times are GMT -4. The time now is 10:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy