User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Read a file

Wed May 13, 2015 4:46 pm

Hi i want to know how can i read a file line from front to back in BASH. thanks! :mrgreen:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

User avatar
rpdom
Posts: 17275
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Read a file

Wed May 13, 2015 4:54 pm

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?

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Read a file

Wed May 13, 2015 5:05 pm

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:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Read a file

Wed May 13, 2015 5:53 pm

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?

Return to “Beginners”