I have a file that has lines file.txt
like this:
www.site.com/230207|Sophie Rundle title: Episodes|5irko3ke
www.site.com/228264|Camilla Luddington title: Balifornication|5423234
www.site.com/228592|Sarah Power title: Californication|23423423
www.site.com/229022|Ali Cobrin title: American Reunion|tgkmktgkmtg
www.site.com/190074|Eva Green title: The Dreamers|rfrrfrf
I want it to be sorted into fileSorted.txt
alphabetically by the word that comes after "title", so the result would be:
www.site.com/229022|Ali Cobrin title: American Reunion|tgkmktgkmtg
www.site.com/228592|Sarah Power title: Balifornication|23423423
www.site.com/228264|Camilla Luddington title: Californication|5423234
www.site.com/230207|Sophie Rundle title: Episodes|5irko3ke
www.site.com/190074|Eva Green title: The Dreamers|rfrrfrf
I know that we have to use the sort
command, so I tried:
sort --field-separator='title:' --key=1 file.txt > fileSorted.txt
but I got this result:
sort: multi-character tab ‘title:’
I tried to search around the internet but I couldn't' find a solution. How can I sort the file the way I want to as explained above? The file has 100K lines so performance matters.