Page 1 of 1

Read a file

Posted: Wed May 13, 2015 4:46 pm
by expandables
Hi i want to know how can i read a file line from front to back in BASH. thanks! :mrgreen:

Re: Read a file

Posted: Wed May 13, 2015 4:54 pm
by rpdom
The "cat" command will list a file.

The "tac" command will list a file backwards.

The "rev" command will list a file with each line back to front.

Which do you want to do?

Re: Read a file

Posted: Wed May 13, 2015 5:05 pm
by expandables
I want to read a file line from the start of the word to the back of it for example the string 'raspberrybluepie',,,,,inth'
I want to read a word out of that string which is raspberry :mrgreen:

Re: Read a file

Posted: Wed May 13, 2015 5:53 pm
by B.Goode
expandables wrote:Hi i want to know how can i read a file line from front to back in BASH.
and
expandables wrote:I want to read a file line from the start of the word to the back of it for example the string 'raspberrybluepie',,,,,inth'
I want to read a word out of that string which is raspberry
Being able to define the problem is a good first step before you try to solve it, or before you ask others to solve it for you!

So in your example, how do you know where 'raspberry' ends and 'blue' begins?

Is this an 'artificial intelligence' or 'pattern matching' problem, where you look for a sequence of characters that represents an english word?