Reputation: 11
I have a problem. I have a file in this format:
Hi / Tom /
Be / Nice /
...
And I need to delete "/" and " "(space) and sort it
Be Nice
Hi Tom
...
Upvotes: 0
Views: 3727
Reputation: 77876
you can use tr
command like
cat inputfile.txt | tr -s "\/" "" | tr " " "\n" | sort | tr "\n" " "
Upvotes: 1
Reputation:
for sorted_word in $(for word in $(sed -e 's/\/ //g' path_to_file); do printf "%s\n" ${word}; done | sort); do printf "%s " ${sorted_word}; done ; printf "%s\n"
Upvotes: 1