سطر ترتیب دینے والا

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

قدرتی ترتیب ہندسوں کے سلسلوں کو عدد سمجھ کر موازنہ کرتی ہے، اس لیے file2، file10 کے بعد نہیں بلکہ پہلے آتا ہے۔ عددی ترتیب ہر سطر کا پہلا عدد پڑھتی ہے اور جن سطروں میں کوئی عدد نہ ہو انہیں آخر میں چھوڑ دیتی ہے۔

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

ترتیب خام حرفی قدروں کے موازنے کے بجائے مقامی زبان سے واقف ہوتی ہے، اس لیے اعراب والے اور غیر لاطینی حروف وہیں آتے ہیں جہاں اس زبان کا پڑھنے والا توقع کرے، Z کے پیچھے دھکیلے نہیں جاتے۔ پانچ ترتیبیں دستیاب ہیں: حروفِ تہجی، قدرتی، عددی، لمبائی کے مطابق، اور بے ترتیبی۔ پہلی چار مستحکم ترتیبیں ہیں جنہیں آپ الٹ سکتے ہیں؛ بے ترتیبی فہرست پر Fisher-Yates کا ایک چکر ہے، جو ہر ممکنہ ترتیب کو برابر موقع دیتی ہے اور سمت کی ترتیب کو سرے سے نظر انداز کرتی ہے۔

قدرتی ترتیب سطر کے اندر ہندسوں کے سلسلوں کو عدد سمجھتی ہے، اسی لیے وہ file2 کو file10 سے پہلے رکھتی ہے جبکہ سادہ حروفِ تہجی والی ترتیب ایسا نہیں کرتی۔ عددی ترتیب ہر سطر میں کہیں بھی پہلا عدد ڈھونڈتی ہے — منفی اور اعشاریہ والی قدریں بھی شامل — اور اسی پر ترتیب دیتی ہے، اور جن سطروں میں کوئی عدد نہ ہو انہیں آخر میں بھیج دیتی ہے۔ لمبائی کے مطابق ترتیب حروف کی گنتی کا موازنہ کرتی ہے اور برابری کی صورت میں حروفِ تہجی سے فیصلہ کرتی ہے، تاکہ برابر لمبائی والی سطریں بھی قابلِ پیش گوئی ترتیب میں آئیں۔

اپنے ڈیٹا کے مطابق ترتیب چننا

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

Alphabetical is wrong for numbered data

This is why a natural sort option exists, and it is the thing worth understanding.

A plain alphabetical sort compares character by character. That puts item10 before item2, because the character 1 comes before 2. Everything with a number in it comes out in an order nobody wants: version numbers, file names, chapter headings, invoice references.

A natural sort recognises runs of digits and compares them as numbers, so item2 precedes item10. The [msm_tool slug="sort-lines"] offers both because both are correct for different data.

Case sensitivity changes the order

A case-sensitive sort puts all capitals before all lowercase, because that is their order in the character set. So Zebra comes before apple, which looks like a bug and is not.

For a list of names, titles or anything a person will read, a case-insensitive sort is almost always what you want. For sorting identifiers or code, case sensitivity may matter.

Accented characters sort after Z

A simple sort orders by code point, and accented Latin characters sit above the plain A–Z range. So Ångström lands after Zulu rather than at the beginning where a Swedish reader would expect it — and a French reader would expect é to sort with e, which it does not.

Proper alphabetical ordering is language-specific and genuinely complicated: Swedish puts Å after Z deliberately, German does not, and Spanish used to treat ll as a single letter. A code-point sort is predictable rather than linguistically correct, and for a list anyone will read in a specific language, expect to adjust it by hand.

Removing duplicates while sorting

Sorting groups identical lines together, which makes deduplication trivial — and the comparison is exact. A trailing space makes two visually identical lines different, and they will both survive.

If a deduplication leaves entries you were sure were duplicates, clean the whitespace first and sort again.

Blank lines and the header row

Two practical traps:

  1. Blank lines sort to the top in ascending order, because an empty string sorts before everything. Remove them first unless you want them there.
  2. A header row sorts with the data. Paste a list with a heading line and the heading ends up somewhere in the middle. Take it off first and put it back afterwards.

Reverse is not the opposite of natural

Reversing a natural sort gives you natural order descending, which is what you want. Reversing the lines of an already-sorted list also gives descending order for simple data and does not for anything where the sort was doing real work.

Use the descending option rather than sorting and then reversing.

What this is for

  • Tidying a list of names, tags, keywords or references into a readable order.
  • Finding duplicates in a list by grouping them together.
  • Preparing two lists for comparison — sorting both first means a diff shows genuine differences rather than ordering differences.
  • Making a long list scannable, which is the everyday case and the reason it exists.

Nothing is uploaded; the sort happens in your browser.

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

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

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

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