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

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

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

ٹول لوڈ ہو رہا ہے… 3 میں سے 0 حصے

ٹول تیار کیا جا رہا ہے۔ سست کنکشن پر اس میں چند سیکنڈ لگ سکتے ہیں۔

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

ترتیب خام حرفی قدروں کے موازنے کے بجائے مقامی زبان سے واقف ہوتی ہے، اس لیے اعراب والے اور غیر لاطینی حروف وہیں آتے ہیں جہاں اس زبان کا پڑھنے والا توقع کرے، 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 decides only ties

The sort follows the alphabet first and letter case second, the way a dictionary does. apple and Apple end up next to each other — in most languages the lowercase one comes first — and Zebra still comes after both. Nothing jumps to the top just for starting with a capital.

Ticking the option to ignore case makes apple and Apple equal, so they stay in the order you pasted them. Natural order ignores case regardless.

Accented letters sort where your language puts them

The comparison is the browser's own language-aware one, in the language your browser is set to, rather than a comparison of raw character codes. So é sorts with e, and for an English reader Ångström sits among the A words instead of being pushed past Zulu.

It also means the order follows that language's rules, and those genuinely differ: Swedish puts Å after Z deliberately, German does not, and Spanish used to treat ll as a single letter. For a list meant for readers of another language, set the browser to that language before sorting, or check the result 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 سے پہلے آتا ہے۔ ہندسوں کے سلسلوں کو عدد کے طور پر جانچنے کے لیے قدرتی ترتیب پر جائیں۔
چڑھتی ترتیب میں آخر میں، اور اترتی ترتیب میں شروع میں، کیونکہ چھانٹنے کے بعد پوری فہرست پلٹ دی جاتی ہے۔
نہیں۔ بے ترتیبی کی کوئی سمت نہیں ہوتی — یہ ہر بار چلنے پر فہرست کو اتفاقی طور پر ازسرِنو ترتیب دیتی ہے۔
طے شدہ طور پر موازنہ حروف کی نوعیت کا لحاظ رکھتا ہے۔ نظر انداز کرنے کے لیے اختیار نشان زد کریں۔ قدرتی ترتیب بہرحال حروف کی نوعیت دیکھے بغیر موازنہ کرتی ہے، اور یہ جان بوجھ کر ہے۔
نہیں۔ آپ کی چسپاں کی ہوئی ہر سطر واپس آتی ہے، اور ایک جیسی سطریں ساتھ ساتھ آ جاتی ہیں۔ انہیں ہٹانا الگ کام ہے۔

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