Results 1 to 5 of 5
hi everyone,
i want to compare two lists of files. i want to check which file in List A is not in list B.this is how the lists are;
List ...
- 12-15-2008 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 19
compare numbers within a string
hi everyone,
i want to compare two lists of files. i want to check which file in List A is not in list B.this is how the lists are;
List A List B
file21.txt file21.txt
file23.txt file 22.txt
file24.txt file23.txt
file25.txt file24.txt
so i want the program to tell me that file22.txt is missing from list A.
does anybody have idea on how i can program this? help please.
thank u.
- 12-15-2008 #2
No need to program anything. Do this at the command line:
and all will be revealed.Code:man diff
--
Bill
Old age and treachery will overcome youth and skill.
- 12-16-2008 #3Just Joined!
- Join Date
- Dec 2008
- Posts
- 19
thank you for your prompt reply.
- 12-17-2008 #4Just Joined!
- Join Date
- Dec 2008
- Posts
- 19
About diff and grep command.
About diff and grep command. I am now trying to write a script to compare two files by using diff command and i grep the changes in each line and then count the those lines.
I use this command
diff fileA fileB | grep -e '^c[1-9]' | wc -l
the problem is when there is consecutive changes in two files the output is combined as
$diff fileA fileB | grep -e '^c[1-9]'
c3 10
and hence i get when i count the lines it gives 1
$diff fileA fileB | grep -e '^c[1-9]' | wc -l
1
i would like to count the ocurrence of the changes.In this case i expect the grep output to be
c3
c4
c5 etc.
and when i count them lines i want to have
$diff fileA fileB | grep -e '^c[1-9]' | wc -l
8
please help!
- 12-17-2008 #5
How about this?
Code:#!/bin/bash cat > 4a.txt <<EOD aaa bbb ccc ddd eee EOD cat > 4b.txt <<EOD aaa bbb eee fff ggg hhh EOD diff 4a.txt 4b.txt | grep '^[<>]' | wc -l
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote