maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N800 (https://talk.maemo.org/forumdisplay.php?f=25)
-   -   I just found my old N800 (https://talk.maemo.org/showthread.php?t=76169)

Serafin 2011-09-18 01:20

Re: I just found my old N800
 
Which should be a number one not a letter i -- I don't recall ever typing an i

do you mean in "tail"?

edit: I AM DUMB! I see it now!

Addison 2011-09-18 01:25

Re: I just found my old N800
 
Just copy and paste if you can. :)


rootsh grep -A 13 lock_code /dev/mtd1 | tail -1

Serafin 2011-09-18 01:30

Re: I just found my old N800
 
Quote:

Originally Posted by Addison (Post 1090760)
Just copy and paste if you can. :)


rootsh grep -A 13 lock_code /dev/mtd1 | tail -1

Ok. I did that. Its response was:

" grep: invalid number 'lock_code' "

danramos 2011-09-18 01:50

Re: I just found my old N800
 
Quote:

Originally Posted by Serafin (Post 1090763)
Ok. I did that. Its response was:

" grep: invalid number 'lock_code' "

I think you may have left out the 13 after the -A flag

Serafin 2011-09-18 01:56

Re: I just found my old N800
 
WE DID IT! Thanks guys! You all were amazing. Much appreciated!

danramos 2011-09-18 01:58

Re: I just found my old N800
 
Quote:

Originally Posted by Addison (Post 1090760)
rootsh grep -A 13 lock_code /dev/mtd1 | tail -1

Just do you understand each part...

rootsh is telling the system to run the following as the root user (i.e. full control)
grep is a command that looks for expressions and prints them (literally: g/re/p ...get.. regular expression.. and print)
-A 13 is a flag telling grep to match something and also print the next 13 lines after whatever matches
lock_code is literally the phrase (the expression) we're looking for
/dev/mtd1 is the filename we're going to search through (in this case, a filehandle for Memory Technology Device subsystem number one in Linux)
| is a pipe that takes the output from the commands on the left and feeds it as input to the commands on the right
tail is a command that prints the last few lines of input
-1 is a flag telling the tail command to just print one line (the last line only)

I figured it might help to understand what it's doing to help get the command right.

danramos 2011-09-18 01:59

Re: I just found my old N800
 
Quote:

Originally Posted by Serafin (Post 1090768)
WE DID IT! Thanks guys! You all were amazing. Much appreciated!

Ah--I spent time typing my last entry and didn't see yours. :) Cheers, man! Glad we could help where Nokia clearly wouldn't. heh

Serafin 2011-09-18 02:02

Re: I just found my old N800
 
Quote:

Originally Posted by danramos (Post 1090769)
Just do you understand each part...

rootsh is telling the system to run the following as the root user (i.e. full control)
grep is a command that looks for expressions and prints them (literally: g/re/p ...get.. regular expression.. and print)
-A 13 is a flag telling grep to match something and also print the next 13 lines after whatever matches
lock_code is literally the phrase (the expression) we're looking for
/dev/mtd1 is the filename we're going to search through (in this case, a filehandle for Memory Technology Device subsystem number one in Linux)
| is a pipe that takes the output from the commands on the left and feeds it as input to the commands on the right
tail is a command that prints the last few lines of input
-1 is a flag telling the tail command to just print one line (the last line only)

I figured it might help to understand what it's doing to help get the command right.

that actually makes sense. Thanks so much everyone! I hope this thread helps someone else too.

danramos 2011-09-18 14:34

Re: I just found my old N800
 
Quote:

Originally Posted by danramos (Post 1090769)
Just do you understand each part...

rootsh is telling the system to run the following as the root user (i.e. full control)
grep is a command that looks for expressions and prints them (literally: g/re/p ...get.. regular expression.. and print)
-A 13 is a flag telling grep to match something and also print the next 13 lines after whatever matches
lock_code is literally the phrase (the expression) we're looking for
/dev/mtd1 is the filename we're going to search through (in this case, a filehandle for Memory Technology Device subsystem number one in Linux)
| is a pipe that takes the output from the commands on the left and feeds it as input to the commands on the right
tail is a command that prints the last few lines of input
-1 is a flag telling the tail command to just print one line (the last line only)

I figured it might help to understand what it's doing to help get the command right.

One correction... the g in grep stands for 'globally match'... but 'get' made better sense as an explanation. Just couldn't help correcting it. ;)

Take care!

lma 2011-09-20 08:20

Re: I just found my old N800
 
Quote:

Originally Posted by danramos (Post 1091082)
One correction... the g in grep stands for 'globally match'...

It does, but strictly speaking isn't - g/re/p comes straight from ed(1)[1], and ed's g command accepts an address range (even though it defaults to the entire file). This goes back even to the oldest (V7) version I could find:

Code:

      (1,$)g/regular expression/command list
            In the global command, the first step is to mark every line  which
            matches  the  given regular expression.  Then for every such line,
            the given command list is executed with `.' initially set to  that
            line.  A single command or the first of multiple commands appears
            on the same line with the global command.  All lines of  a  multi-
            line  list except the last line must be ended with `\'.  A, i, and
            c commands and associated input are permitted; the `.' terminating
            input  mode  may be omitted if it would be on the last line of the
            command list.  The commands g and v are not permitted in the  com‐
            mand list.


[1] "Ed is the standard text editor."


All times are GMT. The time now is 10:01.

vBulletin® Version 3.8.8