LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-23-2007, 12:34 PM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Rep: Reputation: 47
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

Last edited by Gins; 06-23-2007 at 12:36 PM.
 
Old 06-23-2007, 12:42 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

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...

Last edited by acid_kewpie; 06-23-2007 at 12:44 PM.
 
Old 06-23-2007, 01:19 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
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!

Last edited by Gins; 06-23-2007 at 01:20 PM.
 
Old 06-23-2007, 07:40 PM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
I more or less know more or less nothing about more or less too.
 
Old 06-23-2007, 09:28 PM   #5
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
type [cat 'grub install'] | less
 
Old 06-23-2007, 09:38 PM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
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?
 
Old 06-23-2007, 10:49 PM   #7
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Which is more? Most or less? No, which is a different thing altogether.
 
Old 06-23-2007, 11:37 PM   #8
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
this is just confusing now :S
 
Old 06-24-2007, 12:55 AM   #9
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
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.)
 
Old 06-24-2007, 01:29 AM   #10
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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!
 
Old 06-24-2007, 01:30 AM   #11
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Does that quote from Joost Kremers make it:
A: Less confusing?
B: More confusing?
C: Most confusing?
 
Old 06-24-2007, 01:59 AM   #12
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Yeah I use 'most' - it has colours :0)
 
Old 06-24-2007, 02:07 AM   #13
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by brianL
Does that quote from Joost Kremers make it:
A: Less confusing?
B: More confusing?
C: Most confusing?
D: all of the above
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Socket: How to read a long maldini1010 Programming 3 02-25-2005 03:56 PM
Wireless Networking Problem - Long Read Sophic Linux - Wireless Networking 1 04-05-2004 12:33 PM
In Serious need of help (long read) kith Linux - General 6 03-27-2004 10:16 AM
I can't read long file names on my CDROM sutcli Linux - Newbie 3 11-02-2003 02:42 PM
Hard drive mounted in read only (After long uptime...) otjervaag Linux - Laptop and Netbook 10 10-04-2003 08:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration