I’ve read this question about how to read n characters from a text file using bash. I would like to know how to read a word at a time from a file that looks like:
example text
example1 text1
example2 text2
example3 text3
Can anyone explain that to me, or show me an easy example?
Thanks!
The
readcommand by default reads whole lines. So the solution is probably to read the whole line and then split it on whitespace with e.g.for: