LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-30-2018, 07:39 PM   #1
L4Z3R
Member
 
Registered: Jan 2018
Posts: 34

Rep: Reputation: Disabled
The commands in FreeBSDs don't work the same like in linux


Hi

I was going to practice some regex in freebsd 11.1, but grep in BSD doesn't support -P perl switch

grep: The -P option is not supported

I then tried to used sed to replace the first letter and make it uppercase like so: Hello There

Code:
echo "hello there" | sed 's/\<\(\w\)/\u\1/g'
echo "hello there" | sed 's/\b\(\w\)/\u\1/g'
echo "hello there" | sed 's/\<\(.)/\u\1/g'
but these didn't work either.

However, it does work in linux.

I'm surprised how limited the commands in BSDs are to linux.
 
Old 01-30-2018, 07:54 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,153

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
To ease your surprise I suggest you investigate what POSIX means.
The try using the POSIX flags on the tools in Linux. You might find it enlightening.
 
1 members found this post helpful.
Old 01-30-2018, 08:24 PM   #3
L4Z3R
Member
 
Registered: Jan 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Hi syg00

The above commands work in linux just fine. In freebsd, the grep command doesn't support the perl switch and sed in freebsd doesn't seem to understand the regex.
 
Old 01-30-2018, 08:43 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,786

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by L4Z3R View Post
I'm surprised how limited the commands in BSDs are to linux.
Did you have a question?

Most GNU/Linux distros come with GNU tools (some, mostly those aimed at tiny machines use things like busybox instead). You can install the GNU tools on BSD as well, if you like.
 
Old 01-30-2018, 08:51 PM   #5
L4Z3R
Member
 
Registered: Jan 2018
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ntubski View Post
Did you have a question?

Most GNU/Linux distros come with GNU tools (some, mostly those aimed at tiny machines use things like busybox instead). You can install the GNU tools on BSD as well, if you like.
I'm new to the BSDs so I don't know much. I'm just testing the waters. Linux is my main desktop
 
  


Reply



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
cc and gcc commands don't work braden87 Programming 6 11-14-2010 06:47 PM
what to install since these commands don't work.. turf Red Hat 4 09-12-2010 06:02 AM
Why don't certain commands work outside of dir? wyntre5150 Linux - General 2 08-17-2007 06:00 PM
Some Commands Don't Work dudeman41465 Linux - Software 5 01-29-2006 08:17 AM
Why don't my WineX commands work? cheeseincarnate Linux - Software 18 07-19-2004 03:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:59 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