LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-14-2010, 05:38 PM   #1
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Viewing Multiple Files with the less command


Hi,

When we view multiple files using less, how to go on to the next file?

I gave these two commands:
Code:
[root@localhost log]# ls -lt boot.log*
-rw------- 1 root root 0 Apr 11 04:02 boot.log
-rw------- 1 root root 0 Apr  4 04:02 boot.log.1
-rw------- 1 root root 0 Apr  1 19:14 boot.log.2
-rw------- 1 root root 0 Mar 21 04:02 boot.log.3
-rw------- 1 root root 0 Mar 14 04:02 boot.log.4

[root@localhost log]# less boot.log*

This is what I got:

Code:
boot.log (file 1 of 5) (END) - Next: boot.log.1 <RETURN>
(END) - Next: boot.log.1

I could not view boot.log.2.

Any tricks?
 
Old 04-14-2010, 05:50 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
man less
Code:
       :n     Examine the next file (from the list of files given in the command line).  If a number N is specified, the  N-th  next  file  is
              examined.

       :p     Examine the previous file in the command line list.  If a number N is specified, the N-th previous file is examined.
 
Old 04-14-2010, 05:50 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Keep hitting **---it will go thru all the files in order.

In your example, note that all those files are empty---thus you'll not be viewing anything.....

** Sorry, I was thinking of "more"--see the other (better) answer

Last edited by pixellany; 04-14-2010 at 05:54 PM. Reason: oops
 
Old 04-14-2010, 06:02 PM   #4
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by troop View Post
man less
Code:
       :n     Examine the next file (from the list of files given in the command line).  If a number N is specified, the  N-th  next  file  is
              examined.

       :p     Examine the previous file in the command line list.  If a number N is specified, the N-th previous file is examined.

It works!


Code:
[root@localhost bin]# less *

date +%H:%M:%S
~
~
~
~
~
showTime.sh (file 2 of 2) (END)
 
  


Reply

Tags
less


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
Command syntax to modify multiple files sg_sonic Linux - Newbie 5 09-27-2009 03:28 PM
Sed Command - - -How to change part of the name of multiple files sahil.jammu Linux - Newbie 6 04-02-2009 11:57 PM
Write to multiple files...one command tekmann33 Linux - Newbie 3 06-04-2008 02:02 PM
problem viewing multiple FC4 partitions from other distros (and Windows) thanto_ Fedora 5 02-14-2006 10:11 PM
How to perform an action (a command) on multiple files with the FOR loop? chun-mee Programming 4 08-23-2005 04:11 AM


All times are GMT -5. The time now is 10:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration