Sponsored Content
Operating Systems Solaris -w option in fgrep for Solaris Post 302837589 by jim mcnamara on Friday 26th of July 2013 06:28:41 AM
Old 07-26-2013
Several points.
one -
Code:
which fgrep

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.

Code:
/usr/xpg4/bin/grep -F -i -w

-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).

fgrep

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:
 

10 More Discussions You Might Find Interesting

1. Programming

Solaris C compiler option -Xc

Anyone know what the -Xc option does? Is there an equivalent option for the Gnu compiler? :confused: (3 Replies)
Discussion started by: BCarlson
3 Replies

2. UNIX for Dummies Questions & Answers

No Password - - Setuid Only Option in Solaris 10

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)
Discussion started by: leond
1 Replies

3. Solaris

AIX to SOLARIS conversion - (find -cmin option)

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)
Discussion started by: nmalencia
1 Replies

4. Solaris

date -d illegal option in Solaris

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)
Discussion started by: linuxgeek
6 Replies

5. Solaris

Solaris 9 : DHCP Option 43 and 60

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)
Discussion started by: fredy82
0 Replies

6. UNIX for Advanced & Expert Users

Problem with useradd, -p option in Solaris 10

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)
Discussion started by: BRH
2 Replies

7. Shell Programming and Scripting

date: illegal option -- d in sun solaris

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)
Discussion started by: Tuxidow
1 Replies

8. Shell Programming and Scripting

Problem in Using fgrep Command with pattern file option

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)
Discussion started by: emresearch
4 Replies

9. Solaris

Solaris 9 : gcc unrecognized -rdynamic option

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)
Discussion started by: bubsland
0 Replies

10. Solaris

Need grep package with -A option for Solaris 10

Hi Guys, I need grep package with -A option for Solaris 10, Where can I download this from, Please advise. (2 Replies)
Discussion started by: manalisharmabe
2 Replies
GZGREP(1)						      General Commands Manual							 GZGREP(1)

NAME
gzgrep, gzegrep, gzfgrep - search possibly compressed files for a regular expression SYNOPSIS
gzgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Gzgrep is used to invoke the grep on compress'ed or gzip'ed files. All options specified are passed directly to grep. If no file is speci- fied, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If gzgrep is invoked as gzegrep or gzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, gzgrep uses it as the grep program to be invoked. For example: for sh: GREP=fgrep gzgrep string files for csh: (setenv GREP fgrep; gzgrep string files) AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), egrep(1), fgrep(1), gzdiff(1), gzmore(1), gznew(1), gzforce(1), gzip(1), gzexe(1) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgzip | +--------------------+-----------------+ |Interface Stability | Committed | +--------------------+-----------------+ NOTES
Source for gzip is available on http://opensolaris.org. GZGREP(1)
All times are GMT -4. The time now is 01:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy