I have a text file, named all.txt, with the following content:
I want to sort it on the URL ignoring the first 2 characters i.e f or c .
To do this, Linux provides a sort command. Using the keydef option, the file can be sorted. To do so, open a terminal window and enter the command below:
sort -k1.2 all.txt <enter>
where 1 is the field, and 2 is the character position from where the sort should start. The -k1.2 parameter is the keydef.
The above command will dump the sorted output on the screen. To put it in another file, enter the command below:
sort -k1.2 all.txt > sortedall.txt <enter>
where sortedall.txt is the file with the sorted data.
To view the options available with sort command in Linux, read the man pages for sort.