grep Option -o

Issues related to applications and software problems
Post Reply
r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

grep Option -o

Post by r_a_mueller » 2018/12/10 11:34:07

Hallo,
I have an Edomi-Server running with CentOS 6.5. Now I wanted to give the server another task. It should run a shell script. In Ubuntu this script worked well, it should extract a certain value from a web page. It used grep with option -o (only matching) and head -1 to extract the value without the surroundig contents. Because the pattern matches to three values on this site, the attached "head -1" guarantees that only the first one is extracted.

Under CentOS the script stops before the grep command. On the CentOS manpage for grep I did not find this option -o. Is there an alternative? Can I install a different package, where grep contains this option?

Thank you very much

-richard

User avatar
TrevorH
Forum Moderator
Posts: 27123
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: grep Option -o

Post by TrevorH » 2018/12/10 11:49:04

First thing: CentOS 6.5 is nearly 5 years old so if you haven't run yum update recently then you really really need to do so. You have a server that has 5 years worth of security vulnerabilities on it and some of those are serious.

Running man grep on a 6.10 system shows
-o, --only-matching
Print only the matched (non-empty) parts of a matching line, with each such part on a
separate output line.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

Re: grep Option -o

Post by r_a_mueller » 2018/12/10 14:47:03

Thanks for your hint. The Edomi software which runs on this machine is optimized for CentOS 6.5. Therefore I don't want to update it, if there are serious threats perhaps I could close the internet connection to this computer. I just looked for a computer running 24/7 to additionally run my small script once a day, and so I thought, take this one!
I tried to use a Fritzbox, but unfortunately they have closed the Telnet-entrance.

User avatar
TrevorH
Forum Moderator
Posts: 27123
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: grep Option -o

Post by TrevorH » 2018/12/10 21:08:17

The Edomi software which runs on this machine is optimized for CentOS 6.5.
The whole point of CentOS and RHEL is that the ABI stays the same for the entire 10 year lifespan of the distro. It should make no difference if you run 6.5 or 6.10 from that POV. What does make a difference is that there are nearly 200 different security bugs fixed between 6.5 and now that are marked as "critical". That doesn't count the ones marked as merely "important" or the other categories less severe than that.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
CentOS 5 has been EOL for nearly 3 years and should no longer be used for anything!
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2427
Joined: 2007/12/11 08:17:33
Location: Finland

Re: grep Option -o

Post by jlehtone » 2018/12/14 09:28:06

What does "optimized for X" mean anyway?
(Marketing speech doesn't count.)

r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

Re: grep Option -o

Post by r_a_mueller » 2018/12/14 16:01:03

The developer of Edomi freeware says that he focuses on Edomi, not the used OS and does not want to adapt his software for different OSs. Edomi runs on small computers for house automization usually 24/7, so I thought I could use this computer for another scipt, whose activating schme is controlled by Cron. Meanwhile I used yum update on the system, but it seems it forgot its IP, so I can not access it via ssh as usually. I'll try to get it running again on the weekend.

Whoever
Posts: 1089
Joined: 2013/09/06 03:12:10

Re: grep Option -o

Post by Whoever » 2018/12/15 04:29:48

There is a dockerized version of Edomi. That might be a better way to go because you can run it on the latest version of the OS. You could run it on CentOS 7.

r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

Re: grep Option -o

Post by r_a_mueller » 2018/12/17 18:42:43

Thanks for the hint. I had troubles installing version 7, so I installed 6.10 in a minimal version. For 7 it said, that the harddisk is too small (33 GB SSD). Perhaps I should have tried the minimal 7. version without graphical desktops etc. But now everything works.
Thanks for your help, folks!

-richard

Post Reply

Return to “CentOS 6 - Software Support”