Grep command Fails on SunOS Sparc


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep command Fails on SunOS Sparc
# 1  
Old 10-07-2016
Grep command Fails on SunOS Sparc

Hi,

This command works

Code:
ggrep -v -F -x -f app1.txt app2.txt

But, I don't have ggrep on SunOS Sparc so I tried using grep instead but it errors out

Code:
grep: illegal option -- F

Code:
bash-2.03$ uname -a
SunOS mymac 5.8 Generic_Virtual sun4v sparc sun4v

Can you help me with a grep command that works on SunOS Sparc?
# 2  
Old 10-07-2016
https://www.unix.com/man-page/opensolaris/1/grep/ says:
Quote:
SYNOPSIS
/usr/bin/grep [-bchilnsvw] limited-regular-expression
[filename]...

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] -e pattern_list...
[-f pattern_file]... [file]...

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx]
[-e pattern_list]... -f pattern_file... [file]...
# 3  
Old 10-07-2016
Hi,

can you share sample input for app1.txt , app2.txt and desired output ?
# 4  
Old 10-07-2016
On any system:
grep -F stands for fgrep
which is a grep without regexp
as
grep -E stands for egrep

so you shoult try
Code:
fgrep -v -x -l -f file1 ...

Also considere that the flags are position dependent : the uppercase flags -F, -E ...would be in 1st position, so you should try :
Code:
grep -F -v -x  -f file1 ...


Last edited by blastit.fr; 10-07-2016 at 07:25 PM.. Reason: typo
# 5  
Old 10-07-2016
Quote:
Originally Posted by blastit.fr
On any system:
grep -F stands for fgrep
which is a grep without regexp
as
grep -F stands for egrep

so you shoult try
Code:
fgrep -v -x -l -f file1 ...

Also considere that the flags are position dependent : the uppercase flags -F, -E ...would be in 1st position, so you should try :
Code:
grep -F -v -x  -f file1 ...

I will assume that the "grep -F stands for egrep" was a typo and you meant to say "grep -F stands for fgrep". But, the standards are perfectly clear that there is absolutely no difference in the behavior of any of the following:
Code:
grep -F -v -x ...
grep -v -F -x ...
grep -x -v -F ...
grep -xvF ...
grep -Fvx ...

as long as the options listed do not include mutually exclusive options (such as −E and −F). If you specify more than one of the mutually exclusive −E and −F options or more than one of the mutually exclusive −c, −l, and −q options in any order; the results are unspecified.
# 6  
Old 10-07-2016
Quote:
Originally Posted by Don Cragun
I will assume that the "grep -F stands for egrep" was a typo and you meant to say "grep -F stands for fgrep". But, the standards are perfectly clear that there is absolutely no difference in the behavior of any of the following:
Code:
grep -F -v -x ...
grep -v -F -x ...
grep -x -v -F ...
grep -xvF ...
grep -Fvx ...

as long as the options listed do not include mutually exclusive options (such as −E and −F). If you specify more than one of the mutually exclusive −E and −F options or more than one of the mutually exclusive −c, −l, and −q options in any order; the results are unspecified.
@Don :
typo corrected
The behaviour of all different grep versions on different unix flavours could be odd. I faced it recently on ibm aix.
# 7  
Old 10-08-2016
Hi.
Quote:
Originally Posted by blastit.fr
... The behaviour of all different grep versions on different unix flavours could be odd. I faced it recently on ibm aix.
On a system:
Code:
aix 7.1.0.0
grep - ( /usr/bin/grep, Oct 01 2012 )

I see:
Code:
$ cat t1
1
2
3

and:
Code:
$ grep -F -v 2 t1
1
3

As well as:
Code:
$ grep -v -F 2 t1
1
3

So it seems OK for that near-trivial test for that system.

However, we often said that AIX was an acronym for AIn't UniX on the 3090 systems we used (way back then) Smilie

Best wishes ... cheers, drl

Last edited by drl; 10-08-2016 at 03:14 PM.. Reason: Correct typo -- thanks Don.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to backup (create image) SunOS 5.10 sparc?

Hello guys! I'm a newbee in Solaris systems. There is an issue, that I've got: I have to make an iso image of my solaris system. How can I do it? with dd utility? Clonezilla does not support spark, so it cant do backup. pls help! Is this solution: Creating a Solaris Flash Archive... (21 Replies)
Discussion started by: 2fat2fly
21 Replies

2. Shell Programming and Scripting

Grep works on Linux but fails on Solaris

Hi, On linux i have the below command working fine. grep -o '<name>.*</name>' deploy.tmp | sed 's/\(<name>\|<\/name>\)//g' deploy.tmp But the same is failing on Solaris uname -a SunOS mymac 5.10 Generic_150400-23 sun4v sparc sun4v Can you tell me how can i get it work on Solaris ?... (6 Replies)
Discussion started by: mohtashims
6 Replies

3. Solaris

SunOS sun4v sparc ntp service in maintenance mode.

Hi experts, This is a production server. Host information's are below SunOS hostname_srv 5.10 Generic_150400-09 sun4v sparc sun4v Now issue with ntp service, This host have zone in it with 9 hosts, Every hosts have ntp service issue. While i check for the service status it's in... (3 Replies)
Discussion started by: babinlonston
3 Replies

4. Solaris

How to scan for LUNs in SunOS sun4v sparc?

Hi everyone, We have the below sun Operating system, Now our storage team have Create a 500GB LUN for this server, How can i scan and mount the shared LUN ? Could anyone help me to resolve this issue. SunOS my_hostname.com 5.10 Generic_150400-09 sun4v sparc sun4v Update: -------- I... (9 Replies)
Discussion started by: babinlonston
9 Replies

5. Solaris

T2000 Sparc server fails boot

I have a T2000 enterprise SPARC server that's no longer on contract with Oracle. It's on old firmware (6.3.x). After a power-down this weekend, it won't boot normally. Boot snapshot at the bottom of the post. It can boot to cdrom, and it'll boot to failsafe mode, but it won't do a regular... (9 Replies)
Discussion started by: val riverwalk
9 Replies

6. UNIX for Dummies Questions & Answers

Strange behaviour of grep in SunOS

Hi I ahve 2 files with below content: cat file1 FILE3 test1 test2 cat file2 file3 ghg test1 test2 i want to use file1 as pattern file and find out the missing strings in file2.(i.e ghg in this case regardless of c ase) I have tried: grep -i -v -f /path/file1 /path/file2 (6 Replies)
Discussion started by: pandeesh
6 Replies

7. Shell Programming and Scripting

grep/egrep fails with $ anchor?

The $ seems to fail for me. I'm using GNU grep 2.5.4 (that is, nothing out of the ordinary, just what came with my distro) but I can't get the final anchor $ to work for me. (^ works as usual.) Behavior without anchor: $ /bin/grep -E 'tium' file tritium tertium quid Expected behavior: $... (2 Replies)
Discussion started by: CRGreathouse
2 Replies

8. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

9. UNIX for Advanced & Expert Users

DES3 encryption in SunOS sparc

Hi, I want to encrypt a unix file using the des3 algorithm. Seems that there are no standard unix utilities readily available. Can you please suggest how I can encrypt a unix file using des3 ? (2 Replies)
Discussion started by: samuel.vincent
2 Replies

10. Solaris

Solaris 10 install fails on sparc

I'm trying to do an upgrade/install from Solaris 8 to Solaris 10 on a SUN Sparc system. I halt the system, as documented, but when I attempt to boot off the distribution DVD; i.e. halt : : OK> boot cdrom The system indicates that the device is 'unrecognizable' These are SUN... (5 Replies)
Discussion started by: imagtek
5 Replies
Login or Register to Ask a Question