One approach is to read a line at a time and count how many '/' are in that line.
Then insert an element into a hashmap where the key is the id of the line (could be sequential (1 to N)) and then sort by the hashmap by value. If you're using Python, this would look like this. Iterating through the keys in order will give you the index of the corresponding line.
Example in Python that prints out lines in sorted order:
import operator
def sort_by_char(lines, ch):
""" Given a list of strings and a character, print out the lines sorted by how many characters (ch) it contains """
hashmap = {}
for idx in range(len(lines)):
line = lines[idx]
count = line.count(ch)
hashmap[idx] = count
sorted_lines = sorted(hashmap.items(), key=operator.itemgetter(1))
for i in range(len(lines)):
print lines[sorted_lines[i][0]]
Alternatively, you could use the count as the key and the line as the value.