I am starting a transition from Geany to Sublime Text, running on Fedora Linux. One thing I’m trying to do is figure out how to sort (selected) IP addresses, or more generally send selected text to a Linux command and replace the text with the output of that command.
Geany has Edit > Format > Send Selection to > Set Custom Commands, which is documented as “You can send the current selection to any of these commands and the output of the command replaces the current selection.” One of my custom commands in Geany is:
sort --field-separator . --key 1,1n --key 2,2n --key 3,3n --key 4,4n
This uses the GNU sort command. If I open a Linux terminal and run something like this:
echo "100.113.34.135
20.16.137.185
10.180.137.71
2.3.4.198
20.130.247.41" | sort --field-separator . --key 1,1n --key 2,2n --key 3,3n --key 4,4n
I get this output:
2.3.4.198
10.180.137.71
20.16.137.185
20.130.247.41
100.113.34.135
In Sublime Text, is there a way that I can set custom terminal commands to send selected text to, and replace the selected text with the output of that command? Or, is there an existing way to sort IP addresses?