عبارت کا موازنہ اور فرق

استعمال کا طریقہ 3 مراحل
  1. اصل اور تبدیل شدہ متن چسپاں کریں۔
  2. موازنے کی بنیاد اور منظر چنیں، ساتھ نظرانداز کرنے کے اختیارات بھی۔
  3. موازنہ کریں دبائیں اور نمایاں تبدیلیاں پڑھیں۔
فرق

فرق نکالنے کے لیے طویل ترین مشترک ذیلی سلسلے کا طریقہ استعمال ہوتا ہے، وہی جو diff استعمال کرتا ہے، اس لیے غیر تبدیل شدہ متن حرف بہ حرف کے بجائے پورے بلاک کے طور پر ملایا جاتا ہے۔

یہ ٹول کیسے کام کرتا ہے

دونوں عبارتیں ٹکڑوں میں بانٹ دی جاتی ہیں — سطریں، الفاظ یا اکہرے حروف — اور پھر وہ سب سے لمبا سلسلہ ڈھونڈ کر موازنہ کیا جاتا ہے جو دونوں میں اسی ترتیب سے موجود ہو۔ اس سلسلے سے باہر ہر چیز یا تو اضافہ ہے یا حذف۔ ورژن کنٹرول کے اوزار فائلوں کا موازنہ اسی طرح کرتے ہیں، اور یہی نتیجے کو قابلِ مطالعہ بناتا ہے: ملتے ہوئے بلاک اپنی جگہ رہتے ہیں، بجائے اس کے کہ ایک سطر داخل ہوتے ہی اس کے بعد کی ہر سطر بدلی ہوئی بتائی جائے۔

دونوں عبارتوں کے شروع اور آخر میں ملنے والے حصے پہچان کر الگ کر دیے جاتے ہیں، اس سے پہلے کہ موازنے کا جدول بنے، اور اصل دستاویزات پر یہ زیادہ تر کام ہی ختم کر دیتا ہے، کیونکہ ترامیم عموماً فائل کے ایک حصے تک محدود ہوتی ہیں۔ حروف کی نوعیت یا گرد و پیش کی خالی جگہ نظر انداز کرنا یہ بدل دیتا ہے کہ کیا میل کھاتا ہے؛ آپ کو ہمیشہ اصل عبارت دکھائی جاتی ہے، اس لیے نظر انداز کیا گیا فرق دوبارہ لکھا نہیں جاتا، بس نمایاں ہونا بند کر دیتا ہے۔

موازنہ پڑھنا

  • ترمیم شدہ سطر ایک حذف اور ایک اضافہ ہوتی ہے: سطر کی سطح پر ترمیم شدہ سطر کا کوئی تصور نہیں — پرانی چلی جاتی ہے اور نئی آ جاتی ہے۔ اندر کیا بدلا ہے یہ دیکھنے کے لیے لفظ کی سطح پر جائیں۔
  • گنتی ٹکڑوں کی ہے، ترامیم کی نہیں: لفظ کی سطح پر ایک دوبارہ لکھا ہوا جملہ درجن بھر اضافے بتا سکتا ہے۔ ان اعداد کو تبدیلیوں کی تعداد سمجھنے کے بجائے مختلف کوششوں کے درمیان موازنے کے لیے استعمال کریں۔
  • سطح بندی سب سے اہم ترتیب ہے: کوڈ اور ساختہ عبارت کے لیے سطریں، نثر کے لیے الفاظ، اور مختصر عبارتوں کے لیے حروف جہاں آپ کسی ایک غلط ہندسے کی تلاش میں ہوں۔
  • حروف کی سطح مہنگی پڑتی ہے: موازنے کی لاگت دونوں لمبائیوں کے حاصلِ ضرب کے ساتھ بڑھتی ہے، اس لیے لمبی دستاویز کا حرف بہ حرف موازنہ اسی دستاویز کے سطر بہ سطر موازنے سے نمایاں طور پر زیادہ وقت لے گا۔

An edited line is a removal and an addition

The comparison works line by line. When a line changes, it is not reported as "modified" — it appears as the old line removed and the new line added, adjacent to each other.

That is how nearly every diff works, and it explains the counts. Change one word in one line and the summary says one removal and one addition, not one change. A file where you altered a comma on every line will report as entirely rewritten.

The [msm_tool slug="text-diff"] works this way, and knowing it stops the numbers being alarming.

Whitespace counts

Two lines that look identical differ if one has a trailing space, or if one uses tabs where the other uses spaces. The comparison is exact.

This is the most common source of "these are the same, why is it showing a difference". Trailing whitespace is invisible in most editors, and it is the usual culprit. If a diff shows changes you cannot see, that is what to look for first.

Line endings are the other invisible difference

Windows ends lines with a carriage return and a line feed; Unix and macOS use a line feed alone. A file that has travelled between the two can differ on every single line while looking identical.

If an entire document reports as changed and you know it has not been, check the line endings before checking anything else.

Reordering is not detected as reordering

Move a paragraph from the top of a document to the bottom, and the diff reports it as removed from one place and added in another. It has no concept of a block having moved.

That is correct behaviour for a line-based comparison and it makes large reorganisations hard to read. For those, comparing section by section is usually more informative than comparing the whole document.

What it is genuinely good at

  • Verifying a small edit. Confirming that a change to a config file, a contract or a translation touched only what you intended.
  • Comparing two versions someone sent you without version control — two Word exports, two email drafts, two vendor quotes.
  • Checking a copy-paste survived. Whether the text in the CMS matches the text that was approved.
  • Finding an unintended change. The diff you run because something broke and you want to know what moved.

What to use instead, when

For code under version control, your version control system's diff is better — it knows the history, handles renames, and can show word-level changes within a line.

For prose where you want to see which words changed rather than which lines, a word-level comparison is far more readable. A line-based diff of a rewritten paragraph tells you the paragraph changed, which you knew.

For structured data — JSON, YAML, configuration — a structural comparison is better again, because it ignores formatting and key order and reports what actually differs.

Nothing is uploaded

Both texts are compared in your browser, which is worth knowing when the documents are a contract, an unreleased announcement, or anything else you would rather not paste into a service.

اکثر پوچھے گئے سوالات

خاص طور پر عبارت کا موازنہ اور فرق کے بارے میں۔ اس زمرے سے متعلق عمومی سوالات کے جواب زمرے کے صفحے پر موجود ہیں۔

سطر کے موازنے میں ترمیم شدہ کی کوئی حالت نہیں — پرانی سطر ایک حذف ہے اور نئی ایک اضافہ۔ سطر کے اندر کی تبدیلی لفظ کی سطح دکھاتی ہے۔
الفاظ۔ سطر کا موازنہ ایک لفظ ہلنے پر پورا پیراگراف بدلا ہوا بتا دیتا ہے، اور حروف کا موازنہ کارآمد ہونے سے زیادہ شور مچاتا ہے۔
نہیں۔ وہ صرف یہ طے کرتے ہیں کہ کیا میل کھاتا ہے۔ جو دکھایا جاتا ہے وہ ہمیشہ بالکل وہی ہوتا ہے جو آپ نے چسپاں کیا تھا۔
اس کی لاگت دونوں لمبائیوں کے ضرب کے ساتھ بڑھتی ہے۔ پہلے سطر کے مطابق موازنہ کر کے بدلے ہوئے حصے میں اترنا بہت تیز رہتا ہے۔
عبارتیں مختلف تو ہیں، مگر صرف ان پہلوؤں میں جنہیں آپ نے نظر انداز کرنے کو کہا — حروف کی نوعیت، یا گرد و پیش کی خالی جگہ۔ فرق دیکھنے کے لیے وہ اختیارات ہٹا دیں۔

نئے ٹولز، خصوصیات اور کارکردگی بڑھانے کے مشوروں کی اطلاع پانے کے لیے سبسکرائب کریں۔