Welcome to forums, hope you will enjoy learning/sharing knowledge/experiences here with us. Request you to please use code tags as per forum rules for codes/Inputs/commands which you are using into your posts. Following is the forum rules link (https://www.unix.com/misc.php?do=cfrules) which you could through once and can see how important is code tags here to maintain the forums standards because it makes our life really easy to help/advice/solve/guide everyone. Coming to your question you could once use Search option present in the command bar too for checking these kind of solutions as this is one of the common asked question here, following may help you in same though.
Output will be as follows.
Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
Hi how do you compare it in ksh
ALINES=$(cat AFILE | wc -l)
BFIRST=$(head -1 BFILE)
I got ALINES=9 and BFRIST=records'9'
I want 9=9 , how do you write BLINES=9 from records'9' so I can say
ALINES==BLINES
Thanks (4 Replies)
I want a soultion to compare two arrays in sh with an easy way.I want a solution to synchrose users between different AIX servers where no NIS is available. All users are meant to be same on all 10 servers. So the approach is to consider first server as master user repository and whatever the users... (0 Replies)
Hi all,
How to check whether the given the two dates is minimal.
example:
Date 1 : 23-03-2008 with timestamp
Date 2: 20-03-2008 With tmestamp
I want to compare the twodates and which it gives the minimum date
i wnat to get the output like this below
output: the Date2 is... (1 Reply)
grep '^.......$' /usr/dict/words | cut -c1,2,3,5,6,7
This gives a list of 6 character strings, some are words some not. Any suggestions on how I can get rid of the ones that aren't words and print the ones that are? I have tried look with no luck yet. (1 Reply)
I have four files, I need to compare these files together.
As such i know "sdiff and comm" commands but these commands compare 2 files together. If I use sdiff command then i have to compare each file with other which will increase the codes.
Please suggest if you know some commands whcih can... (6 Replies)
Hi,
file contains only one row.
END OF FILE. ROW COUNT: 8,9
We need to check the file contains exact string "END OF FILE. ROW COUNT: " if yes, get the 8,9 values
then compare if both are equal print the "equal" if not "notequal".
Thanks, (4 Replies)
Hi,
I need your help with the below mentioned issue:
I have 2 files say,
file1.txt:
id|no|cde
a|4|7
b|3|2
c|8|8
d|8|9
file2.txt:
id|no|cde
a|4|6
b|2|2
c|8|8 (1 Reply)
Hi guys, looking for some help with a way to compare data in two files but with some conditions.
example,
File 1 consists of
site1,10.1.1.1
site2,20.2.2.2
site3,30.3.3.3
File 2 contains
site1,l0.1.1.1
site2,50.1.1.1
site3,30.3.3.3
site4,40.1.1.1
I want to be able to match the... (1 Reply)
Hi,
I have a file containing a list of codes, followed by a description, such as below:
008.0,ESCHERICHIA COLI
008.1,ARIZONA
008.2,AEROBACTER AEROGENES
008.6,ENTERITIS DUE TO SPECIFIED VIRUS
008.8,OTHER ORGANISM, NOT ELSEWHERE CLASSIFIED
008,INTESTINAL INFECTIONS DUE TO OTHER ORGANISMSI... (6 Replies)
Discussion started by: carlr
6 Replies
LEARN ABOUT OSF1
sdiff
sdiff(1) General Commands Manual sdiff(1)NAME
sdiff - Compares two files and displays the differences in a side-by-side format
SYNOPSIS
sdiff [-l | -s] [-w number] [-o output_file] file1 file2
The sdiff command reads file1 and file2, uses diff to compare them, and writes the results to standard output in a side-by-side format.
OPTIONS
Displays only the left side when lines are identical. Creates a third file, output_file, by a controlled interactive line-by-line merging
of file1 and file2. The following subcommands govern the creation of this file: Adds the left side to output_file. Adds the right side to
output_file. Stops displaying identical lines. Begins displaying identical lines. Enters ed with the left side, the right side, both
sides, or an empty file, respectively.
Each time you exit from ed, sdiff writes the resulting edited file to the end of output_file. If you fail to save the changes
before exiting, sdiff writes the initial input to output_file. Exits the interactive session. Suppresses display of identical
lines. Sets the width of the output line to number (130 characters by default).
DESCRIPTION
The sdiff command displays each line of the two files with a series of spaces between them if the lines are identical, a < (left angle
bracket) in the field of spaces if the line only exists in file1, a > (right angle bracket) if the line only exists in file2, and a | (ver-
tical bar) for lines that are different.
When you specify the -o option, sdiff produces a third file by merging file1 and file2 according to your instructions.
Note that the sdiff command invokes the diff -b command to compare two input files. The -b option causes the diff command to ignore trail-
ing spaces, tab characters, and consider other strings of spaces as equal.
EXAMPLES
To print a comparison of two files, enter: sdiff chap1.bak chap1
This displays a side-by-side listing that compares each line of chap1.bak and chap1. To display only the lines that differ, enter:
sdiff -s-w 80 chap1.bak chap1
This displays the differences at the tty. The -w 80 sets page width to 80 columns. The -s option tells sdiff not to display lines
that are identical in both files. To selectively combine parts of two files, enter: sdiff -s-w 80 -o chap1.combo chap1.bak
chap1
This combines chap1.bak and chap1 into a new file called chap1.combo. For each group of differing lines, sdiff asks you which group
to keep or whether you want to edit them using ed.
SEE ALSO
Commands: diff(1), ed(1)sdiff(1)