LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to read long files on the shell? (https://www.linuxquestions.org/questions/linux-general-1/how-to-read-long-files-on-the-shell-563981/)

Gins 06-23-2007 12:34 PM

How to read long files on the shell?
 
There is a file named 'grub-install'

As a superuser I wrote the following:

[cat 'grub-install']

I can't read the whole file. It is too long. I can't read the first part of the file. My screen is not long enough to read the first part of the file. How do I read the whole file?

[root@ /]# find / -name 'grub-install'
/sbin/grub-install
[root@ /]#

As a matter of fact the file in question is a script.
I am pasting a part of it here.

----------------------------------------------------------
exit 1
fi

if test "x$tmp_part" != x; then
# If a partition is specified, we need to translate it into the
# GRUB's syntax.
case "$host_os" in
linux*)
echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;;
gnu*)
if echo $tmp_part | grep "^s" >/dev/null; then
tmp_pc_slice=`echo $tmp_part \
| sed "s%s\([0-9]*\)[a-g]*$%\1%"`
tmp_drive=`echo "$tmp_drive" \
| sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
fi
if echo $tmp_part | grep "[a-g]$" >/dev/null; then
tmp_bsd_partition=`echo "$tmp_part" \
| sed "s%[^a-g]*\([a-g]\)$%\1%"`
tmp_drive=`echo "$tmp_drive" \
| sed "s%)%,$tmp_bsd_partition)%"`
fi

acid_kewpie 06-23-2007 12:42 PM

you've not discovered the "less" command yet? or more? or vi? or emacs? or pico? or nano? 1,000+ posts? :confused:

less grub-install

you've probably no reason to want to read it though, i doubt you'd understand it. i doubt i'd find it exactly easy...

Gins 06-23-2007 01:19 PM

Thanks acid kewpie
I like your humour. Though I have posted thousands of questions I don't know 'less' !

You are correct. There are many things in UNIX which I don't know. The reason is my idiocy!

brianL 06-23-2007 07:40 PM

I more or less know more or less nothing about more or less too.
:scratch: :D

AceofSpades19 06-23-2007 09:28 PM

type [cat 'grub install'] | less

Emerson 06-23-2007 09:38 PM

Yep, there are more and less. More is actually less than less, meaning less is more than more. But there also is most, has anybody tried it?

brianL 06-23-2007 10:49 PM

Which is more? Most or less? No, which is a different thing altogether.

AceofSpades19 06-23-2007 11:37 PM

this is just confusing now :S

truthfatal 06-24-2007 12:55 AM

From http://www.slackbook.org/html/file-commands-pagers.html
Quote:

Joost Kremers puts it this way:

less is more, but more more than more is, so more is less less, so use more less if you want less more
It made me giggle the first time I read it. (The page also give a little description of the pagers less, more, and most. So this post isn't completely random.)

Nylex 06-24-2007 01:29 AM

Quote:

Originally Posted by AceofSpades19
type [cat 'grub install'] | less

FWIW, you don't need to use "cat filename | less", you can just do "less filename".

truthfatal, that quote is hilarious!

brianL 06-24-2007 01:30 AM

Does that quote from Joost Kremers make it:
A: Less confusing? :scratch:
B: More confusing? :scratch: :scratch:
C: Most confusing? :scratch: :scratch: :scratch:

dive 06-24-2007 01:59 AM

Yeah I use 'most' - it has colours :0)

AceofSpades19 06-24-2007 02:07 AM

Quote:

Originally Posted by brianL
Does that quote from Joost Kremers make it:
A: Less confusing? :scratch:
B: More confusing? :scratch: :scratch:
C: Most confusing? :scratch: :scratch: :scratch:

D: all of the above :p


All times are GMT -5. The time now is 07:02 AM.