1

I have text file with a lot of text in it, and I would like to sort every word one below other how can I do that. For ex.

cat PDF | less word one, word two. Word three ? 

I need them to be

word one word two Word three 

1 Answer 1

5

This isn't really what I would call sorting.

You could either squeeze and transliterate all non-alphabetic sequences into newlines

tr -sc '[:alpha:]' '[\n*]' < PDF 

or (at least with GNU grep) match and output sequences of word characters (alpha, decimal digits and underscore), one per line using the -o option

grep -o '\w*' PDF 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.