The pipeline that you're running is:
Please just enter the command:
and look at the output produced. Note that this command is the first command in your pipeline after the shell expands the file1 and file2 variables.
Note that there are lines starting with < which identify lines that are in file2, but not in file1; lines starting with > which identify lines that are in file1, but not in file2; and lines not starting with < or > that indicate where the lines starting with < and > appear in the files. The second stage in your pipeline:
says that you want to discard all of the output produced by diff except for the lines that have < as the first character on the line. This means that you are throwing away all of the information that tells you whether the lines you have selected are lines that are different in file1 than they are in file2 or are only present in file2. You are also throwing away all of the information that shows lines that are in file2, but not present in file1; lines that show how a line that changed appears in file2; and lines that were in file1, but are not present in file2; and all of the lines that indicate where lines that were added, deleted, or changed appear in these files.
If this is what you want and you also want to throw away the first two characters (< and space) from the remaining lines, replace the
in your pipeline with:
I have to compare two files for any differences, then output the lab and question number for any differences. This is what I currently have:
diff lab2.txt lab2answer.txt > lab2compare.txt
Though the output doesn't have to be sent to a .txt (or any sort of log), I found that easier, at least... (2 Replies)
I have two files like this:
#FILE 1
ABCD 4322 26485
JMTJ 5311 97248
XMPJ 4321 58978
#FILE 2
ABCD 4321 26485
JMTJ 5311 97248
XMPJ 4321 68978
What to do: Compare the two files and find those lines that doesn't match. And have a new file like this:
#FILE 3
"from file 1"
ABCD 4322 26485... (11 Replies)
Hi there,
I'm sure this question has been asked many times but I can't find any posts with information.
How can I check the differences between say lines 20 - 200 in file1 and lines 420 - 600 in file2?
Thanks in advance for any help!
js (2 Replies)
I know the diff does this but it does output more info than just the different text
(e.g.
$ diff file1 file2
29a30
> /home/alex/Pictures/hello.jpg
1694a1696
> /home/alex/Pictures/hi.jpg
)
How can I make it output only
/home/alex/Pictures/hello.jpg
/home/alex/Pictures/hi.jpg
?
thank... (2 Replies)
It seems like a common task, but I haven't been able to find the solution.
vitallog.txt
1310,John,Hancock
13211,Steven,Mills
122,Jane,Doe
138,Thoms,Doe
1500,Micheal,May
vitalinfo.txt
12122,Jane,Thomas
122,Janes,Does
123,Paul,Kite
**OUTPUT**
vitalfiltered.txt
12122,Jane,Thomas... (2 Replies)
Hi all,
i have 50 files .data should be same in these 50 files , so my task is to find the difference. i need a logic , which finds difference between all files and print in output file with file name where it found that difference .
i tried below logic , but its not giving me what i want.
let... (2 Replies)
I have 2 files of almost same text apart from 2,3 ending lines. Now I want to get that difference in another file.
e.g file1.txt is
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
18G 2.4G 15G 14% /
tmpfs 504M ... (12 Replies)
Hi All,
Am trying script to compare 2 files and print the difference found from old file to new file on line by line basis on side by side display.
Basically line by line comparision and files may contain blank line as well
I know we have compare/diff commands but i don't how to make... (10 Replies)