Several points.
one -
is a must to figure out which fgrep you are running.
The options are different for /usr/bin/fgrep and /usr/xpg4/bin/fgrep.
two -
/usr/xpg4/bin/grep (NOT fgrep) will do exactly what you want.
-F means run exactly like fgrep.
It is a capital letter F.
three -
fgrep is no longer supported by POSIX. It was supposed to go away in 1997. It is there so old code will not break. All new code should consider a modern grep -F (in this case /usr/xpg4/bin/grep -F).
four -
It is important to set your PATH to select modern commands on Solaris, by having /usr/bin/xpg4 before /usr/bin in the PATH variable. Unless you are running ancient code. Or need BSD support. You should always use nawk, not awk if you want modern behavior in awk.
Why? - any example code on the internet - especially on unix.com - will show you conforming behavior for code. When you run the old grep, fgrep, or awk then the examples will not work.
This User Gave Thanks to jim mcnamara For This Post:
But my concern is will /usr/sfw/bin/ggrep available in all solaris version?
Solaris 10 only. Solaris 11 has it /usr/gnu/grep. Previous releases might have it installed in /usr/local/bin/grep but there is no guarantee. There are also Solaris 10 installations when /usr/sfw/bin/ggrep is not installed but this is uncommon.
Quote:
More interestingly i cannot found any man page for this ggrep..can u pls let me know somethign about this command.
Use
or add /usr/sfw/share/man to your MANPATH.
---------- Post updated at 13:07 ---------- Previous update was at 13:02 ----------
Quote:
Originally Posted by jim mcnamara
/usr/xpg4/bin/grep (NOT fgrep) will do exactly what you want.
-F means run exactly like fgrep.
It is a capital letter F.
I'm afraid it won't. As far as I known, /usr/xpg4/bin/grep doesn't support the -w option when combined with -F given the fact it is not specified by POSIX (and that makes sense, searching a word is expected to be implemented by regular expressions while -F precisely disable regular expressions).
Hi all,
I'm trying to compile gdb (7.4.1) 64 bit on Solaris 9 SPARC.
First, I launch the configuration
~/gdb-7.4.1$>CC="gcc -m64" ./configure --disable-tui --prefix=$HOME/destdir/
Then, compilation
~/gdb-7.4.1$>make
During compilation gcc (3.4.6) is not enable to recognized the option... (0 Replies)
Hi,
i am using fgrep command with following syntax
fgrep -v -f pattern_file_name file
file contains few line and have the pattern which i am giving in pattern file.
My Problem is :
its is not giving any output.
while i am using fgrep -f pattern_file_name file
it is showing all... (4 Replies)
Hi all,
I am trying to execute the following command in a sun solaris machine and getting the error as below.
bash-2.03$ date -d "1 day ago" +%Y%m%d
date: illegal option -- d
bash-2.03$ uname -a
SunOS gtrd02 5.8 Generic_117350-55 sun4u sparc SUNW,Sun-Fire-V440
Can anybody help me to... (1 Reply)
Good day all.
I'm trying to add a user with useradd and the -p option to assign a project name, but the result is that the user is created with an error message: "UX: useradd: user.root name should be all lower case or numeric."
The command:
useradd -d /export/home/tester -g rtpgrp -G... (2 Replies)
Hello,
I need to configure a Cisco VLAN Accesspoint with DHCP using Solaris
dhtadm & pntadm
Network: 10.10.122.0 255.255.255.0
Default Router 10.10.122.1
Scope Range 10.10.122.10 - 254
Option 60 “Cisco AP c1142”
Option 43 ... (0 Replies)
Hi All,
Is it possible to run date -d option in Solaris?
Do we have a work around so that -d option will be recognized
by solaris as it is recognized by linux.
I need this since i am using this in scripting and it works in Linux box. my problem is
it doesn't work in solaris box.
... (6 Replies)
I have a piece of code (below) in a .ksh script running on AIX. I need to convert the code to run .zsh on Solaris. Solaris's find command does not support the -cmin function. Suggestions??
The code searchs for a file (_filename) and determines if it has been written to or modified in the last... (1 Reply)
In Solaris 9, when I built users, there was an option for No Password -- Setuid Only. Now that I'm using Solaris 10, I no longer can find that option.
Is there an equivalent option of No Password --Setuid Only in Solaris 10?
Thanks,
LeonD (1 Reply)