Hello,
I'm still new to linux, and im looking for some helpful ideas.
What I'm trying to do is I need to write a script that will take a text file, which has paragraphs and create another text file which extracts every individual word from that orignal text file and lists them line by line..

example:

text file 1:
hello. this is a test example file! i hope i could get some great ideas...

new text file2:
hello
this
is
a
test
example
file
i
...


and so on...

Any ideas on i how i might go about accomplishing this?

thanks!

Recommended Answers

All 2 Replies

without removing duplicates, you could just replace any spaces with a newline:

sed "s/ /\n/g" originalFile > outputFile

This won't remove punctuation, but you could write another one to do that.

*code not tested, but pretty sure it'll do the trick

tr ' ' '\n' <file > newfile
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.