LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2018, 04:37 PM   #1
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Rep: Reputation: Disabled
Exclamation Impossible demand to use CAT with(?)


EDIT3: The solution is reviewed and summarized in detail in my last post here:
https://www.linuxquestions.org/quest...ml#post5815407




Hello!


Is it absolutely impossible to actually force only the latest logs in /var/log/messages to be shown by solely using the CAT-command? Or at least in combination with CAT? (and not, anything remotely close to, awk, sed, tail or head etc.)

EDIT2: Using a second tool, like tail or more, was the solution, I just did not understand it back then.


Anything of worth would be out of great appreciation.
Cheers!



EDIT3: The solution is reviewed and summarized in detail in my last post here:
https://www.linuxquestions.org/quest...ml#post5815407

Last edited by Pomerano; 02-03-2018 at 04:34 PM.
 
Old 01-26-2018, 04:39 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,143

Rep: Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965
You didn't mention tac...
 
Old 01-26-2018, 04:49 PM   #3
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Wink

Quote:
Originally Posted by dugan View Post
You didn't mention tac...
Haha. Thank you, good Sir, for noticing.
I guess I figured "anything remotely close to" would be enough
 
Old 01-26-2018, 05:00 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,125

Rep: Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921
cat, like most tools does what it was designed to do. Do one job, do it well - pipe the results to the next tool that may be better suited.
 
1 members found this post helpful.
Old 01-26-2018, 05:13 PM   #5
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by syg00 View Post
cat, like most tools does what it was designed to do. Do one job, do it well - pipe the results to the next tool that may be better suited.
Roger, thank you for noticing me.
 
Old 01-26-2018, 05:21 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,219
Blog Entries: 11

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
I have read your question several times and am still not sure I understand what you are trying to achieve.

Is your question looking for an alternative to cat, or a way to display only certain logs or selected information from logs?

It would help if you could describe what you are trying to do and why cat is not working for you.
 
Old 01-26-2018, 05:22 PM   #7
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,016
Blog Entries: 5

Rep: Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861
No. Modify cat and recompile it.

Last edited by hydrurga; 01-26-2018 at 05:41 PM.
 
1 members found this post helpful.
Old 01-26-2018, 05:34 PM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,143

Rep: Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965Reputation: 3965
Quote:
Is it absolutely impossible to actually force only the latest logs in /var/log/messages to be shown by solely using the CAT-command?
Serious answer:

yes.

Last edited by dugan; 01-26-2018 at 05:35 PM.
 
1 members found this post helpful.
Old 01-26-2018, 06:12 PM   #9
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by dugan View Post
Serious answer:

yes.

Thank you for the further elaborated answer!
 
Old 01-27-2018, 01:15 AM   #10
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,271

Rep: Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916Reputation: 1916
I like to use 'less /var/log/messages' followed by 'G' to see the last messages.
 
Old 01-27-2018, 03:55 AM   #11
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Lightbulb OMG!

Quote:
Originally Posted by allend View Post
I like to use 'less /var/log/messages' followed by 'G' to see the last messages.
Is this in combination with CAT?!
Please, oh please good Sir! - Could you just be an absolute GOD and format what you just said so that it runs an output in the terminal?

I really hope you can!
 
Old 01-27-2018, 04:14 AM   #12
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,064

Rep: Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130Reputation: 4130
still not sure what do you need. (for example you need the latest log files or the last lines of logfiles or what?).
By the way logrotate will drop out the old messages, so you will see only the latest in /var/log. Regardless of the command you use (awk/grep/perl/cat/whatever)
 
Old 01-27-2018, 05:45 AM   #13
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by astrogeek View Post
I have read your question several times and am still not sure I understand what you are trying to achieve.

Is your question looking for an alternative to cat, or a way to display only certain logs or selected information from logs?

It would help if you could describe what you are trying to do and why cat is not working for you.

Thank you so much for your effort to help me and I do apologize, on my behalf, for the possible 'conundrum' I may have caused in this matter

Now, basically - in plain English - what I ultimately would like to do is...:
Reduce the number of results for which is triggered by the line command cat /var/log/messages. The only condition I have is that shall not replace the command cat in any way.

Lately, I have had two interesting and very intriguing replies, for that matter of which it states that this can actually be done! - Using LESS or logrotate in combination with cat.
Unfortuntely, so far I have not found out how to resolve this, using these methods, but time will tell. I'm sure of it

With all the best intentions /Pom

P.S. Are you in any part involved in copyheart.org? - That was a great link. - Thanks!

Last edited by Pomerano; 01-27-2018 at 05:54 AM.
 
Old 01-27-2018, 05:51 AM   #14
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,016
Blog Entries: 5

Rep: Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861Reputation: 2861
Quote:
Originally Posted by Pomerano View Post
Thank you so much for your effort to help me and I do apologize, on my behalf, for the possible 'conundrum' I may have caused in this matter

Now, basically - in plain english - what I ultimately would like to do is...:
Reduce the number of results for which is triggered by the line command cat /var/log/messages. Only condition I have is that it does not replace the command cat in anyway. Lately I've had two interesting replies where it states that this can be done using LESS or logrotate in combination with cat. Now, so far I haven't found how to resolve this using these methods but time will tell I hope

With all the best intentions, Pom
Out of interest, why?
 
Old 01-27-2018, 06:08 AM   #15
Pomerano
LQ Newbie
 
Registered: Jan 2018
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by hydrurga View Post
Out of interest, why?
Actually, this was an old task given from one of the former teachers who used to work here. He was mostly known as 'Prf. Magic' because of his perception of achieving the unachievable. This could include unconventional methods of doing the simplest tasks using the most tedious and outdated methods: Such as this one. Although, in this modern age I did kind of hope for a workaround regarding this.

He is now retired and lives somewhere in Spain with his hot and young wife, Nastasia. Most likely sipping piña coladas from her belly button on a daily basis

Thank you for the interest

Last edited by Pomerano; 01-27-2018 at 07:07 AM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
any cat people here ? one crazy cat s/woman/man/g here. ////// General 46 02-02-2018 11:13 AM
difference :: cat file_1 & cat < f_1 tushar_pandey Linux - Newbie 4 08-16-2012 09:19 AM
Cat 6 Cat 5e cable question babbab Linux - Networking 1 04-07-2010 02:33 PM
cat in asm/ cat --show-all option Tux Linux - Software 1 09-02-2006 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:22 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration