diff options
author | Yuri Pankov <yuri.pankov@nexenta.com> | 2018-02-10 10:06:23 +0300 |
---|---|---|
committer | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-02-12 11:57:46 +0100 |
commit | e54e6a394a25bb87fc39c6f223d139a8b9f8d778 (patch) | |
tree | 5f4bd442a6d59caea5f2f86aab8afe3eb35d3019 | |
parent | a932645c0cce2aa5d10deea389394577f47b3608 (diff) | |
download | illumos-joyent-e54e6a394a25bb87fc39c6f223d139a8b9f8d778.tar.gz |
9088 fgrep and egrep don't need to have separate man pages
9089 grep man page synopsis and utility usage need to be sane
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
-rw-r--r-- | usr/src/cmd/grep/grep.c | 59 | ||||
-rw-r--r-- | usr/src/man/man1/Makefile | 809 | ||||
-rw-r--r-- | usr/src/man/man1/egrep.1 | 277 | ||||
-rw-r--r-- | usr/src/man/man1/fgrep.1 | 268 | ||||
-rw-r--r-- | usr/src/man/man1/grep.1 | 888 | ||||
-rw-r--r-- | usr/src/pkg/manifests/SUNWcs.man1.inc | 6 |
6 files changed, 809 insertions, 1498 deletions
diff --git a/usr/src/cmd/grep/grep.c b/usr/src/cmd/grep/grep.c index 3658af2e35..eabd465cca 100644 --- a/usr/src/cmd/grep/grep.c +++ b/usr/src/cmd/grep/grep.c @@ -1524,59 +1524,12 @@ out: static void usage(void) { - if (egrep || fgrep) { - (void) fprintf(stderr, gettext("Usage:\t%s"), cmdname); - (void) fprintf(stderr, - gettext(" [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] pattern_list [file ...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] [-e pattern_list]... " - "[-f pattern_file]... [file...]\n")); - } else { - (void) fprintf(stderr, gettext("Usage:\t%s"), cmdname); - (void) fprintf(stderr, - gettext(" [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] pattern_list [file ...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] [-e pattern_list]... " - "[-f pattern_file]... [file...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" -E [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] pattern_list [file ...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" -E [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] [-e pattern_list]... " - "[-f pattern_file]... [file...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" -F [-c|-l|-q] [-r|-R] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] pattern_list [file ...]\n")); - - (void) fprintf(stderr, "\t%s", cmdname); - (void) fprintf(stderr, - gettext(" -F [-c|-l|-q] " - "[-A num] [-B num] [-C num|-num] " - "[-bhHinsvx] [-e pattern_list]... " - "[-f pattern_file]... [file...]\n")); - } + (void) fprintf(stderr, gettext("usage: %5s"), cmdname); + if (!egrep && !fgrep) + (void) fprintf(stderr, gettext(" [-E|-F]")); + (void) fprintf(stderr, gettext(" [-bchHilnqrRsvx] [-A num] [-B num] " + "[-C num|-num]\n [-e pattern_list]... " + "[-f pattern_file]... [pattern_list] [file]...\n")); exit(2); /* NOTREACHED */ } diff --git a/usr/src/man/man1/Makefile b/usr/src/man/man1/Makefile index 8dc13a00f6..fb16e3462d 100644 --- a/usr/src/man/man1/Makefile +++ b/usr/src/man/man1/Makefile @@ -11,7 +11,7 @@ # # Copyright 2011, Richard Lowe -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. # Copyright 2014 Garrett D'Amore <garrett@damore.org> # @@ -20,420 +20,419 @@ include $(SRC)/Makefile.master MANSECT= 1 MANFILES= acctcom.1 \ - adb.1 \ - addbib.1 \ - alias.1 \ - allocate.1 \ - amt.1 \ - appcert.1 \ - apptrace.1 \ - apropos.1 \ - ar.1 \ - arch.1 \ - asa.1 \ - at.1 \ - atq.1 \ - atrm.1 \ - audioconvert.1 \ - audioctl.1 \ - audioplay.1 \ - audiorecord.1 \ - audiotest.1 \ - auths.1 \ - awk.1 \ - banner.1 \ - basename.1 \ - bc.1 \ - bdiff.1 \ - break.1 \ - builtin.1 \ - cal.1 \ - cancel.1 \ - cat.1 \ - cd.1 \ - cdrw.1 \ - checknr.1 \ - chgrp.1 \ - chkey.1 \ - chmod.1 \ - chown.1 \ - ckdate.1 \ - ckgid.1 \ - ckint.1 \ - ckitem.1 \ - ckkeywd.1 \ - ckpath.1 \ - ckrange.1 \ - ckstr.1 \ - cksum.1 \ - cktime.1 \ - ckuid.1 \ - ckyorn.1 \ - clear.1 \ - cmp.1 \ - col.1 \ - comm.1 \ - command.1 \ - compress.1 \ - cp.1 \ - cpio.1 \ - cputrack.1 \ - crle.1 \ - crontab.1 \ - crypt.1 \ - csh.1 \ - csplit.1 \ - ctags.1 \ - ctrun.1 \ - ctstat.1 \ - ctwatch.1 \ - cut.1 \ - date.1 \ - dc.1 \ - deallocate.1 \ - deroff.1 \ - dhcpinfo.1 \ - diff.1 \ - diff3.1 \ - diffmk.1 \ - digest.1 \ - dircmp.1 \ - dis.1 \ - disown.1 \ - dispgid.1 \ - dispuid.1 \ - dos2unix.1 \ - download.1 \ - dpost.1 \ - du.1 \ - dump.1 \ - dumpcs.1 \ - echo.1 \ - ed.1 \ - egrep.1 \ - eject.1 \ - elfdump.1 \ - elfedit.1 \ - elfsign.1 \ - elfwrap.1 \ - enable.1 \ - encrypt.1 \ - enhance.1 \ - env.1 \ - eqn.1 \ - exec.1 \ - exit.1 \ - expand.1 \ - expr.1 \ - exstr.1 \ - factor.1 \ - fdformat.1 \ - fgrep.1 \ - file.1 \ - filesync.1 \ - find.1 \ - finger.1 \ - fmt.1 \ - fmtmsg.1 \ - fold.1 \ - ftp.1 \ - gcore.1 \ - gencat.1 \ - genmsg.1 \ - getconf.1 \ - getfacl.1 \ - getlabel.1 \ - getopt.1 \ - getoptcvt.1 \ - getopts.1 \ - gettext.1 \ - gettxt.1 \ - getzonepath.1 \ - glob.1 \ - gprof.1 \ - grep.1 \ - groups.1 \ - hash.1 \ - head.1 \ - history.1 \ - hostid.1 \ - hostname.1 \ - iconv.1 \ - indxbib.1 \ - Intro.1 \ - ipcrm.1 \ - ipcs.1 \ - isainfo.1 \ - isalist.1 \ - jobs.1 \ - join.1 \ - kbd.1 \ - kdestroy.1 \ - keylogin.1 \ - keylogout.1 \ - kill.1 \ - kinit.1 \ - klist.1 \ - kmdb.1 \ - kmfcfg.1 \ - kpasswd.1 \ - krb5-config.1 \ - ksh93.1 \ - ktutil.1 \ + adb.1 \ + addbib.1 \ + alias.1 \ + allocate.1 \ + amt.1 \ + appcert.1 \ + apptrace.1 \ + apropos.1 \ + ar.1 \ + arch.1 \ + asa.1 \ + at.1 \ + atq.1 \ + atrm.1 \ + audioconvert.1 \ + audioctl.1 \ + audioplay.1 \ + audiorecord.1 \ + audiotest.1 \ + auths.1 \ + awk.1 \ + banner.1 \ + basename.1 \ + bc.1 \ + bdiff.1 \ + break.1 \ + builtin.1 \ + cal.1 \ + cancel.1 \ + cat.1 \ + cd.1 \ + cdrw.1 \ + checknr.1 \ + chgrp.1 \ + chkey.1 \ + chmod.1 \ + chown.1 \ + ckdate.1 \ + ckgid.1 \ + ckint.1 \ + ckitem.1 \ + ckkeywd.1 \ + ckpath.1 \ + ckrange.1 \ + ckstr.1 \ + cksum.1 \ + cktime.1 \ + ckuid.1 \ + ckyorn.1 \ + clear.1 \ + cmp.1 \ + col.1 \ + comm.1 \ + command.1 \ + compress.1 \ + cp.1 \ + cpio.1 \ + cputrack.1 \ + crle.1 \ + crontab.1 \ + crypt.1 \ + csh.1 \ + csplit.1 \ + ctags.1 \ + ctrun.1 \ + ctstat.1 \ + ctwatch.1 \ + cut.1 \ + date.1 \ + dc.1 \ + deallocate.1 \ + deroff.1 \ + dhcpinfo.1 \ + diff.1 \ + diff3.1 \ + diffmk.1 \ + digest.1 \ + dircmp.1 \ + dis.1 \ + disown.1 \ + dispgid.1 \ + dispuid.1 \ + dos2unix.1 \ + download.1 \ + dpost.1 \ + du.1 \ + dump.1 \ + dumpcs.1 \ + echo.1 \ + ed.1 \ + eject.1 \ + elfdump.1 \ + elfedit.1 \ + elfsign.1 \ + elfwrap.1 \ + enable.1 \ + encrypt.1 \ + enhance.1 \ + env.1 \ + eqn.1 \ + exec.1 \ + exit.1 \ + expand.1 \ + expr.1 \ + exstr.1 \ + factor.1 \ + fdformat.1 \ + file.1 \ + filesync.1 \ + find.1 \ + finger.1 \ + fmt.1 \ + fmtmsg.1 \ + fold.1 \ + ftp.1 \ + gcore.1 \ + gencat.1 \ + genmsg.1 \ + getconf.1 \ + getfacl.1 \ + getlabel.1 \ + getopt.1 \ + getoptcvt.1 \ + getopts.1 \ + gettext.1 \ + gettxt.1 \ + getzonepath.1 \ + glob.1 \ + gprof.1 \ + grep.1 \ + groups.1 \ + hash.1 \ + head.1 \ + history.1 \ + hostid.1 \ + hostname.1 \ + iconv.1 \ + indxbib.1 \ + Intro.1 \ + ipcrm.1 \ + ipcs.1 \ + isainfo.1 \ + isalist.1 \ + jobs.1 \ + join.1 \ + kbd.1 \ + kdestroy.1 \ + keylogin.1 \ + keylogout.1 \ + kill.1 \ + kinit.1 \ + klist.1 \ + kmdb.1 \ + kmfcfg.1 \ + kpasswd.1 \ + krb5-config.1 \ + ksh93.1 \ + ktutil.1 \ kvmstat.1 \ - lari.1 \ - last.1 \ - lastcomm.1 \ - ld.1 \ - ldap.1 \ - ldapdelete.1 \ - ldaplist.1 \ - ldapmodify.1 \ - ldapmodrdn.1 \ - ldapsearch.1 \ - ldd.1 \ - ld.so.1.1 \ - let.1 \ - lex.1 \ - lgrpinfo.1 \ - limit.1 \ - line.1 \ - list_devices.1 \ - listusers.1 \ - ln.1 \ - loadkeys.1 \ - locale.1 \ - localedef.1 \ - logger.1 \ - login.1 \ - logname.1 \ - logout.1 \ - look.1 \ - lookbib.1 \ - lorder.1 \ - lp.1 \ - lpstat.1 \ - ls.1 \ - m4.1 \ - mac.1 \ - mach.1 \ - madv.so.1.1 \ - mail.1 \ - mailcompat.1 \ - mailstats.1 \ - mailx.1 \ + lari.1 \ + last.1 \ + lastcomm.1 \ + ld.1 \ + ld.so.1.1 \ + ldap.1 \ + ldapdelete.1 \ + ldaplist.1 \ + ldapmodify.1 \ + ldapmodrdn.1 \ + ldapsearch.1 \ + ldd.1 \ + let.1 \ + lex.1 \ + lgrpinfo.1 \ + limit.1 \ + line.1 \ + list_devices.1 \ + listusers.1 \ + ln.1 \ + loadkeys.1 \ + locale.1 \ + localedef.1 \ + logger.1 \ + login.1 \ + logname.1 \ + logout.1 \ + look.1 \ + lookbib.1 \ + lorder.1 \ + lp.1 \ + lpstat.1 \ + ls.1 \ + m4.1 \ + mac.1 \ + mach.1 \ + madv.so.1.1 \ + mail.1 \ + mailcompat.1 \ + mailstats.1 \ + mailx.1 \ make.1 \ - makekey.1 \ - man.1 \ - mandoc.1 \ - mconnect.1 \ - mcs.1 \ - mdb.1 \ - mesg.1 \ - mkdir.1 \ - mkmsgs.1 \ - mktemp.1 \ - moe.1 \ - more.1 \ - mpss.so.1.1 \ - msgcc.1 \ - msgcpp.1 \ - msgcvt.1 \ - msgfmt.1 \ - msggen.1 \ - msgget.1 \ - mt.1 \ - mv.1 \ - nawk.1 \ - nc.1 \ - nca.1 \ - ncab2clf.1 \ - ncakmod.1 \ - newform.1 \ - newgrp.1 \ - news.1 \ - newtask.1 \ - nice.1 \ - nl.1 \ - nm.1 \ - nohup.1 \ - nroff.1 \ - od.1 \ - optisa.1 \ - pack.1 \ - pagesize.1 \ - pargs.1 \ - passwd.1 \ - paste.1 \ - pathchk.1 \ - pax.1 \ - pfexec.1 \ - pg.1 \ - pgrep.1 \ - pkginfo.1 \ - pkgmk.1 \ - pkgparam.1 \ - pkgproto.1 \ - pkgtrans.1 \ - pktool.1 \ - plabel.1 \ - plgrp.1 \ - plimit.1 \ - pmadvise.1 \ - pmap.1 \ - postio.1 \ - postprint.1 \ - postreverse.1 \ - ppgsz.1 \ - ppriv.1 \ - pr.1 \ - praliases.1 \ - prctl.1 \ - preap.1 \ - prex.1 \ - print.1 \ - printf.1 \ - priocntl.1 \ - proc.1 \ - prof.1 \ - profiles.1 \ - projects.1 \ - ps.1 \ + makekey.1 \ + man.1 \ + mandoc.1 \ + mconnect.1 \ + mcs.1 \ + mdb.1 \ + mesg.1 \ + mkdir.1 \ + mkmsgs.1 \ + mktemp.1 \ + moe.1 \ + more.1 \ + mpss.so.1.1 \ + msgcc.1 \ + msgcpp.1 \ + msgcvt.1 \ + msgfmt.1 \ + msggen.1 \ + msgget.1 \ + mt.1 \ + mv.1 \ + nawk.1 \ + nc.1 \ + nca.1 \ + ncab2clf.1 \ + ncakmod.1 \ + newform.1 \ + newgrp.1 \ + news.1 \ + newtask.1 \ + nice.1 \ + nl.1 \ + nm.1 \ + nohup.1 \ + nroff.1 \ + od.1 \ + optisa.1 \ + pack.1 \ + pagesize.1 \ + pargs.1 \ + passwd.1 \ + paste.1 \ + pathchk.1 \ + pax.1 \ + pfexec.1 \ + pg.1 \ + pgrep.1 \ + pkginfo.1 \ + pkgmk.1 \ + pkgparam.1 \ + pkgproto.1 \ + pkgtrans.1 \ + pktool.1 \ + plabel.1 \ + plgrp.1 \ + plimit.1 \ + pmadvise.1 \ + pmap.1 \ + postio.1 \ + postprint.1 \ + postreverse.1 \ + ppgsz.1 \ + ppriv.1 \ + pr.1 \ + praliases.1 \ + prctl.1 \ + preap.1 \ + prex.1 \ + print.1 \ + printf.1 \ + priocntl.1 \ + proc.1 \ + prof.1 \ + profiles.1 \ + projects.1 \ + ps.1 \ psecflags.1 \ - ptree.1 \ - pvs.1 \ - pwd.1 \ - ranlib.1 \ - rcapstat.1 \ - rcp.1 \ - rdist.1 \ - read.1 \ - readonly.1 \ - refer.1 \ - regcmp.1 \ - renice.1 \ - rev.1 \ - rlogin.1 \ - rm.1 \ - rmformat.1 \ - rmmount.1 \ - roffbib.1 \ - roles.1 \ - rpcgen.1 \ - rsh.1 \ - runat.1 \ - rup.1 \ - ruptime.1 \ - rusers.1 \ - rwho.1 \ - sar.1 \ - script.1 \ - sdiff.1 \ - sed.1 \ + ptree.1 \ + pvs.1 \ + pwd.1 \ + ranlib.1 \ + rcapstat.1 \ + rcp.1 \ + rdist.1 \ + read.1 \ + readonly.1 \ + refer.1 \ + regcmp.1 \ + renice.1 \ + rev.1 \ + rlogin.1 \ + rm.1 \ + rmformat.1 \ + rmmount.1 \ + roffbib.1 \ + roles.1 \ + rpcgen.1 \ + rsh.1 \ + runat.1 \ + rup.1 \ + ruptime.1 \ + rusers.1 \ + rwho.1 \ + sar.1 \ + script.1 \ + sdiff.1 \ + sed.1 \ sendmail-mailq.1 \ - set.1 \ - setfacl.1 \ - setlabel.1 \ - setpgrp.1 \ - shcomp.1 \ - shell_builtins.1 \ - shift.1 \ - size.1 \ - sleep.1 \ - smbutil.1 \ - soelim.1 \ - sort.1 \ - sortbib.1 \ - sotruss.1 \ - spell.1 \ - split.1 \ - srchtxt.1 \ - strchg.1 \ - strings.1 \ - strip.1 \ - stty.1 \ - sum.1 \ - suspend.1 \ - svcprop.1 \ - svcs.1 \ - symorder.1 \ + set.1 \ + setfacl.1 \ + setlabel.1 \ + setpgrp.1 \ + shcomp.1 \ + shell_builtins.1 \ + shift.1 \ + size.1 \ + sleep.1 \ + smbutil.1 \ + soelim.1 \ + sort.1 \ + sortbib.1 \ + sotruss.1 \ + spell.1 \ + split.1 \ + srchtxt.1 \ + strchg.1 \ + strings.1 \ + strip.1 \ + stty.1 \ + sum.1 \ + suspend.1 \ + svcprop.1 \ + svcs.1 \ + symorder.1 \ + sys-suspend.1 \ sysV-make.1 \ - sys-suspend.1 \ - tabs.1 \ - tail.1 \ - talk.1 \ - tar.1 \ - tbl.1 \ - tcopy.1 \ - tee.1 \ - telnet.1 \ - test.1 \ - tftp.1 \ - time.1 \ - times.1 \ - timex.1 \ - tip.1 \ - tnfdump.1 \ - tnfxtract.1 \ - touch.1 \ - tput.1 \ - tr.1 \ - trap.1 \ - troff.1 \ - true.1 \ - truss.1 \ - tsort.1 \ - tty.1 \ - type.1 \ - typeset.1 \ - ul.1 \ - umask.1 \ - uname.1 \ - unifdef.1 \ - uniq.1 \ - units.1 \ - unix2dos.1 \ - uptime.1 \ + tabs.1 \ + tail.1 \ + talk.1 \ + tar.1 \ + tbl.1 \ + tcopy.1 \ + tee.1 \ + telnet.1 \ + test.1 \ + tftp.1 \ + time.1 \ + times.1 \ + timex.1 \ + tip.1 \ + tnfdump.1 \ + tnfxtract.1 \ + touch.1 \ + tput.1 \ + tr.1 \ + trap.1 \ + troff.1 \ + true.1 \ + truss.1 \ + tsort.1 \ + tty.1 \ + type.1 \ + typeset.1 \ + ul.1 \ + umask.1 \ + uname.1 \ + unifdef.1 \ + uniq.1 \ + units.1 \ + unix2dos.1 \ + uptime.1 \ uuidgen.1 \ vacation.1 \ - vgrind.1 \ - volcheck.1 \ - volrmmount.1 \ + vgrind.1 \ + volcheck.1 \ + volrmmount.1 \ vtfontcvt.1 \ - w.1 \ - wait.1 \ - wc.1 \ - which.1 \ - who.1 \ - whocalls.1 \ - whois.1 \ - write.1 \ - xargs.1 \ - xgettext.1 \ - xstr.1 \ - yacc.1 \ - yes.1 \ - ypcat.1 \ - ypmatch.1 \ - yppasswd.1 \ - ypwhich.1 \ - zlogin.1 \ - zonename.1 + w.1 \ + wait.1 \ + wc.1 \ + which.1 \ + who.1 \ + whocalls.1 \ + whois.1 \ + write.1 \ + xargs.1 \ + xgettext.1 \ + xstr.1 \ + yacc.1 \ + yes.1 \ + ypcat.1 \ + ypmatch.1 \ + yppasswd.1 \ + ypwhich.1 \ + zlogin.1 \ + zonename.1 MANLINKS= batch.1 \ - bg.1 \ - case.1 \ - chdir.1 \ - checkeq.1 \ - continue.1 \ - decrypt.1 \ - dirname.1 \ - dirs.1 \ - disable.1 \ + bg.1 \ + case.1 \ + chdir.1 \ + checkeq.1 \ + continue.1 \ + decrypt.1 \ + dirname.1 \ + dirs.1 \ + disable.1 \ dmake.1 \ - dumpkeys.1 \ + dumpkeys.1 \ edit.1 \ - errange.1 \ + egrep.1 \ + errange.1 \ errdate.1 \ errgid.1 \ errint.1 \ @@ -448,6 +447,7 @@ MANLINKS= batch.1 \ false.1 \ fc.1 \ fg.1 \ + fgrep.1 \ for.1 \ foreach.1 \ function.1 \ @@ -618,6 +618,9 @@ return.1 := LINKSRC = exit.1 unexpand.1 := LINKSRC = expand.1 +egrep.1 := LINKSRC = grep.1 +fgrep.1 := LINKSRC = grep.1 + hashstat.1 := LINKSRC = hash.1 rehash.1 := LINKSRC = hash.1 unhash.1 := LINKSRC = hash.1 diff --git a/usr/src/man/man1/egrep.1 b/usr/src/man/man1/egrep.1 deleted file mode 100644 index b3d8d2ca96..0000000000 --- a/usr/src/man/man1/egrep.1 +++ /dev/null @@ -1,277 +0,0 @@ -'\" te -.\" Copyright 1989 AT&T -.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved -.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved -.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at -.\" http://www.opengroup.org/bookstore/. -.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. -.\" This notice shall appear on any product containing this material. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH EGREP 1 "Nov 28, 2017" -.SH NAME -egrep \- search a file for a pattern using full regular expressions -.SH SYNOPSIS -.LP -.nf -\fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR] - [\fIfile...\fR] -.fi - -.LP -.nf -\fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR - [\fIfile...\fR] -.fi - -.LP -.nf -\fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR] -.fi - -.SH DESCRIPTION -.LP -The \fBegrep\fR (\fIexpression grep\fR) utility searches files for a pattern of -characters and prints all lines that contain that pattern. \fBegrep\fR uses -full regular expressions (expressions that have string values that use the full -set of alphanumeric and special characters) to match the patterns. It uses a -fast deterministic algorithm that sometimes needs exponential space. -.sp -.LP -If no files are specified, \fBegrep\fR assumes standard input. Normally, each -line found is copied to the standard output. The file name is printed before -each line found if there is more than one input file. -.LP -The \fBegrep\fR utility accepts the same form of full regular expressions as -\fBgrep\fR(1) -E option. -.sp -.LP -Be careful using the characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR, -\fB)\fR, and \fB\e\fR in \fIfull regular expression\fR, because they are also -meaningful to the shell. It is safest to enclose the entire \fIfull regular -expression\fR in single quotes (\fBa\'\fR\fBa\'\fR). -.sp -.LP -The order of precedence of operators is \fB[\|]\fR, then \fB*\|?\|+\fR, then -concatenation, then | and NEWLINE. -.SH OPTIONS -.LP -The following options are supported: -.sp -.ne 2 -.na -\fB\fB-b\fR\fR -.ad -.RS 6n -Precede each line by the block number on which it was found. This can be useful -in locating block numbers by context (first block is 0). -.RE - -.sp -.ne 2 -.na -\fB\fB-c\fR\fR -.ad -.RS 6n -Print only a count of the lines that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-e\fR \fIpattern_list\fR\fR -.ad -.RS 6n -Search for a \fIpattern_list\fR (\fIfull regular expression\fR that begins with -a \fB\(mi\fR). -.RE - -.sp -.ne 2 -.na -\fB\fB-f\fR \fIfile\fR\fR -.ad -.RS 6n -Take the list of \fIfull\fR \fIregular\fR \fIexpressions\fR from \fIfile\fR. -.RE - -.sp -.ne 2 -.na -\fB\fB-H\fR\fR -.ad -.RS 6n -Precedes each line by the name of the file containing the matching line. -.RE - -.sp -.ne 2 -.na -\fB\fB-h\fR\fR -.ad -.RS 6n -Suppress printing of filenames when searching multiple files. -.RE - -.sp -.ne 2 -.na -\fB\fB-i\fR\fR -.ad -.RS 6n -Ignore upper/lower case distinction during comparisons. -.RE - -.sp -.ne 2 -.na -\fB\fB-l\fR\fR -.ad -.RS 6n -Print the names of files with matching lines once, separated by NEWLINEs. Does -not repeat the names of files when the pattern is found more than once. -.RE - -.sp -.ne 2 -.na -\fB\fB-n\fR\fR -.ad -.RS 6n -Precede each line by its line number in the file (first line is 1). -.RE - -.sp -.ne 2 -.na -\fB\fB-q\fR\fR -.ad -.RS 6n -Quiet. Does not write anything to the standard output, regardless of matching -lines. Exits with zero status if an input line is selected. -.RE - -.sp -.ne 2 -.na -\fB\fB-s\fR\fR -.ad -.RS 6n -Legacy equivalent of \fB-q\fR. -.RE - -.sp -.ne 2 -.na -\fB\fB-v\fR\fR -.ad -.RS 6n -Print all lines except those that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-x\fR\fR -.ad -.RS 6n -Consider only input lines that use all characters in the line to match an -entire fixed string or regular expression to be matching lines. -.RE - -.SH OPERANDS -.LP -The following operands are supported: -.sp -.ne 2 -.na -\fB\fIfile\fR\fR -.ad -.RS 8n -A path name of a file to be searched for the patterns. If no \fIfile\fR -operands are specified, the standard input is used. -.RE - -.ne 2 -.na -\fB\fIpattern\fR\fR -.ad -.RS 8n -Specify one or more patterns to be used during the search for input. This -operand is treated as if it were specified as \fB-e\fR\fIpattern_list\fR. -.RE - -.SH USAGE -.LP -See \fBlargefile\fR(5) for the description of the behavior of \fBegrep\fR when -encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). -.SH ENVIRONMENT VARIABLES -.LP -See \fBenviron\fR(5) for descriptions of the following environment variables -that affect the execution of \fBegrep\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, -\fBLC_MESSAGES\fR, and \fBNLSPATH\fR. -.SH EXIT STATUS -.LP -The following exit values are returned: -.sp -.ne 2 -.na -\fB\fB0\fR\fR -.ad -.RS 5n -If any matches are found. -.RE - -.sp -.ne 2 -.na -\fB\fB1\fR\fR -.ad -.RS 5n -If no matches are found. -.RE - -.sp -.ne 2 -.na -\fB\fB2\fR\fR -.ad -.RS 5n -For syntax errors or inaccessible files (even if matches were found). -.RE - -.SH ATTRIBUTES -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: - -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -CSI Enabled -.TE - -.SH SEE ALSO -.LP -\fBfgrep\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1), \fBattributes\fR(5), -\fBenviron\fR(5), \fBlargefile\fR(5), \fBregex\fR(5), \fBregexp\fR(5), -\fBXPG4\fR(5) -.SH NOTES -.LP -Ideally there should be only one \fBgrep\fR command, but there is not a single -algorithm that spans a wide enough range of space-time trade-offs. -.sp -.LP -Lines are limited only by the size of the available virtual memory. -.LP -The \fB/usr/bin/egrep\fR utility is identical to \fB/usr/bin/grep\fR -\fB-E\fR. See \fBgrep\fR(1). Portable applications should use -\fB/usr/bin/grep\fR \fB-E\fR. -.LP -In the past the behavior of \fB/usr/xpg4/bin/egrep\fR and -\fB/usr/bin/egrep\fR utilities was different. Now \fB/usr/bin/egrep\fR -is replaced by \fB/usr/xpg4/bin/egrep\fR. diff --git a/usr/src/man/man1/fgrep.1 b/usr/src/man/man1/fgrep.1 deleted file mode 100644 index 3bf3b724e5..0000000000 --- a/usr/src/man/man1/fgrep.1 +++ /dev/null @@ -1,268 +0,0 @@ -'\" te -.\" Copyright 1989 AT&T -.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved -.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved -.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at -.\" http://www.opengroup.org/bookstore/. -.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. -.\" This notice shall appear on any product containing this material. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH FGREP 1 "Nov 28, 2017" -.SH NAME -fgrep \- search a file for a fixed-character string -.SH SYNOPSIS -.LP -.nf -\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR] - [\fIfile...\fR] -.fi - -.LP -.nf -\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR - [\fIfile...\fR] -.fi - -.LP -.nf -\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR] -.fi - -.SH DESCRIPTION -.LP -The \fBfgrep\fR (fast \fBgrep\fR) utility searches files for a character string -and prints all lines that contain that string. \fBfgrep\fR is different from -\fBgrep\fR(1) and from \fBegrep\fR(1) because it searches for a string, instead -of searching for a pattern that matches an expression. \fBfgrep\fR uses a fast -and compact algorithm. -.sp -.LP -The characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR, \fB)\fR, and -\fB\e\fR are interpreted literally by \fBfgrep\fR, that is, \fBfgrep\fR does -not recognize full regular expressions as does \fBegrep\fR. These characters -have special meaning to the shell. Therefore, to be safe, enclose the entire -\fIstring\fR within single quotes (\fBa\'\fR). -.sp -.LP -If no files are specified, \fBfgrep\fR assumes standard input. Normally, each -line that is found is copied to the standard output. The file name is printed -before each line that is found if there is more than one input file. -.SH OPTIONS -.LP -The following options are supported: -.sp -.ne 2 -.na -\fB\fB-b\fR\fR -.ad -.RS 6n -Precedes each line by the block number on which the line was found. This can be -useful in locating block numbers by context. The first block is 0. -.RE - -.sp -.ne 2 -.na -\fB\fB-c\fR\fR -.ad -.RS 6n -Prints only a count of the lines that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-e\fR \fIpattern_list\fR\fR -.ad -.RS 6n -Searches for a \fIstring\fR in \fIpattern-list\fR. This is useful when the -\fIstring\fR begins with a \fB\(mi\fR\&. -.RE - -.sp -.ne 2 -.na -\fB\fB-f\fR \fIpattern-file\fR\fR -.ad -.RS 6n -Takes the list of patterns from \fIpattern-file\fR. -.RE - -.sp -.ne 2 -.na -\fB\fB-H\fR\fR -.ad -.RS 6n -Precedes each line by the name of the file containing the matching line. -.RE - -.sp -.ne 2 -.na -\fB\fB-h\fR\fR -.ad -.RS 6n -Suppresses printing of files when searching multiple files. -.RE - -.sp -.ne 2 -.na -\fB\fB-i\fR\fR -.ad -.RS 6n -Ignores upper/lower case distinction during comparisons. -.RE - -.sp -.ne 2 -.na -\fB\fB-l\fR\fR -.ad -.RS 6n -Prints the names of files with matching lines once, separated by new-lines. -Does not repeat the names of files when the pattern is found more than once. -.RE - -.sp -.ne 2 -.na -\fB\fB-n\fR\fR -.ad -.RS 6n -Precedes each line by its line number in the file. The first line is 1. -.RE - -.sp -.ne 2 -.na -\fB\fB-q\fR\fR -.ad -.RS 6n -Quiet. Does not write anything to the standard output, regardless of matching -lines. Exits with zero status if an input line is selected. -.RE - -.sp -.ne 2 -.na -\fB\fB-s\fR\fR -.ad -.RS 6n -Legacy equivalent of \fB-q\fR. -.RE - -.sp -.ne 2 -.na -\fB\fB-v\fR\fR -.ad -.RS 6n -Prints all lines except those that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-x\fR\fR -.ad -.RS 6n -Prints only lines that are matched entirely. -.RE - -.SH OPERANDS -.LP -The following operands are supported: -.sp -.ne 2 -.na -\fB\fIfile\fR\fR -.ad -.RS 8n -Specifies a path name of a file to be searched for the patterns. If no -\fIfile\fR operands are specified, the standard input will be used. -.RE - -.ne 2 -.na -\fB\fIpattern\fR\fR -.ad -.RS 8n -Specifies one or more patterns to be used during the search for input. This -operand is treated as if it were specified as \fB-e\fR \fIpattern_list\fR. -.RE - -.SH USAGE -.LP -See \fBlargefile\fR(5) for the description of the behavior of \fBfgrep\fR when -encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). -.SH ENVIRONMENT VARIABLES -.LP -See \fBenviron\fR(5) for descriptions of the following environment variables -that affect the execution of \fBfgrep\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, -\fBLC_MESSAGES\fR, and \fBNLSPATH\fR. -.SH EXIT STATUS -.LP -The following exit values are returned: -.sp -.ne 2 -.na -\fB\fB0\fR\fR -.ad -.RS 5n -If any matches are found -.RE - -.sp -.ne 2 -.na -\fB\fB1\fR\fR -.ad -.RS 5n -If no matches are found -.RE - -.sp -.ne 2 -.na -\fB\fB2\fR\fR -.ad -.RS 5n -For syntax errors or inaccessible files, even if matches were found. -.RE - -.SH ATTRIBUTES -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -CSI Enabled -.TE - -.SH SEE ALSO -.LP -\fBed\fR(1), \fBegrep\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1), -\fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBXPG4\fR(5) -.SH NOTES -.LP -Ideally, there should be only one \fBgrep\fR command, but there is not a single -algorithm that spans a wide enough range of space-time tradeoffs. -.sp -.LP -Lines are limited only by the size of the available virtual memory. -.LP -The \fB/usr/bin/fgrep\fR utility is identical to \fB/usr/bin/grep\fR -\fB-F\fR (see \fBgrep\fR(1)). Portable applications should use -\fB/usr/bin/grep\fR \fB-F\fR. -.LP -In the past the behavior of \fB/usr/xpg4/bin/fgrep\fR and -\fB/usr/bin/fgrep\fR utilities was different. Now \fB/usr/bin/fgrep\fR -is replaced by \fB/usr/xpg4/bin/fgrep\fR. diff --git a/usr/src/man/man1/grep.1 b/usr/src/man/man1/grep.1 index 0b663de61b..92e25a96d3 100644 --- a/usr/src/man/man1/grep.1 +++ b/usr/src/man/man1/grep.1 @@ -1,518 +1,418 @@ -'\" te -.\" Copyright 2017 Nexenta Systems, Inc. All rights reserved. +.\" +.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for +.\" permission to reproduce portions of its copyrighted documentation. +.\" Original documentation from The Open Group can be obtained online at +.\" http://www.opengroup.org/bookstore/. +.\" +.\" The Institute of Electrical and Electronics Engineers and The Open +.\" Group, have given us permission to reprint portions of their +.\" documentation. +.\" +.\" In the following statement, the phrase ``this text'' refers to portions +.\" of the system documentation. +.\" +.\" Portions of this text are reprinted and reproduced in electronic form +.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition, +.\" Standard for Information Technology -- Portable Operating System +.\" Interface (POSIX), The Open Group Base Specifications Issue 6, +.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics +.\" Engineers, Inc and The Open Group. In the event of any discrepancy +.\" between these versions and the original IEEE and The Open Group +.\" Standard, the original IEEE and The Open Group Standard is the referee +.\" document. The original Standard can be obtained online at +.\" http://www.opengroup.org/unix/online.html. +.\" +.\" This notice shall appear on any product containing this material. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" .\" Copyright 1989 AT&T -.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved -.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at -.\" http://www.opengroup.org/bookstore/. -.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. -.\" This notice shall appear on any product containing this material. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH GREP 1 "Nov 28, 2017" -.SH NAME -grep \- search a file for a pattern -.SH SYNOPSIS -.LP -.nf -\fB/usr/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR] - [\fB-bHhinsvwx\fR] [\fB-A\fR \fInumber\fR] [\fB-B\fR \fInumber\fR] [\fB-C\fR \fInumber\fR | \fB-\fR\fInumber\fR] \fB-e\fR \fIpattern_list\fR... [\fB-f\fR \fIpattern_file\fR]... - [\fIfile\fR]... -.fi - -.LP -.nf -\fB/usr/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR] - [\fB-bHhinsvwx\fR] [\fB-A\fR \fInumber\fR] [\fB-B\fR \fInumber\fR] [\fB-C\fR \fInumber\fR | \fB-\fR\fInumber\fR] [\fB-e\fR \fIpattern_list\fR]... \fB-f\fR \fIpattern_file\fR... - [\fIfile\fR]... -.fi - -.LP -.nf -\fB/usr/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR] - [\fB-bHhinsvwx\fR] [\fB-A\fR \fInumber\fR] [\fB-B\fR \fInumber\fR] [\fB-C\fR \fInumber\fR | \fB-\fR\fInumber\fR] \fIpattern\fR [\fIfile\fR]... -.fi - -.SH DESCRIPTION -.LP -The \fBgrep\fR utility searches text files for a pattern and prints all lines -that contain that pattern. It uses a compact non-deterministic algorithm. -.sp -.LP -Be careful using the characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, \fB|\fR, -\fB(\fR, \fB)\fR, and \fB\e\fR in the \fIpattern_list\fR because they are also -meaningful to the shell. It is safest to enclose the entire \fIpattern_list\fR -in single quotes \fB\'\fR\&...\fB\'\fR\&. -.sp -.LP -If no files are specified, \fBgrep\fR assumes standard input. Normally, each -line found is copied to standard output. The file name is printed before each -line found if there is more than one input file. -.LP -The options \fB-E\fR and \fB-F\fR affect the way \fBgrep\fR -interprets \fIpattern_list\fR. If \fB-E\fR is specified, -\fBgrep\fR interprets \fIpattern_list\fR as a full regular -expression (see \fB-E\fR for description). If \fB-F\fR is specified, -\fBgrep\fR interprets \fIpattern_list\fR as a fixed string. If neither are -specified, \fBgrep\fR interprets \fIpattern_list\fR as a basic regular -expression as described on \fBregex\fR(5) manual page. -.SH OPTIONS -.LP +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved +.\" Copyright 2018 Nexenta Systems, Inc. +.\" +.Dd February 10, 2018 +.Dt GREP 1 +.Os +.Sh NAME +.Nm grep , +.Nm egrep , +.Nm fgrep +.Nd search a file for a pattern +.Sh SYNOPSIS +.Nm grep +.Op Fl E Ns | Ns Fl F +.Op Fl bchHilnrRsqvwx +.Op Fl A Ar num +.Op Fl B Ar num +.Op Fl C Ar num Ns | Ns Fl Ns Ar num +.Oo Fl e Ar pattern_list Oc Ns ... +.Oo Fl f Ar pattern_file Oc Ns ... +.Op Ar pattern_list +.Oo Ar file Oc Ns ... +.Sh DESCRIPTION +The +.Nm +utility searches text files for a pattern and prints all lines that contain that +pattern. +If no files are specified, +.Nm +assumes standard input. +Normally, each line found is copied to standard output. +The file name is printed before each line found if there is more than one input +file. +.Pp +.Nm +handles patterns as basic regular expressions (BREs); +.Nm egrep +.Pq same as Nm Fl E +handles patterns as extended regular expressions (EREs); +.Nm fgrep +.Pq same as Nm Fl F +handles patterns as fixed strings. +.Sh OPTIONS The following options are supported: -.sp -.ne 2 -.na -\fB\fB-A\fR \fInumber\fR\fR -.ad -.RS 6n -Prints \fInumber\fR input lines of context after each matching line. If there -are multiple matching lines, their context lines are separated by a \fB--\fR +.Bl -tag -width Ds +.It Fl A Ar num +Prints +.Ar num +input lines of context after each matching line. +If there are multiple matching lines, their context lines are separated by a +.Ql -- delimiter line. -.RE - -.sp -.ne 2 -.na -\fB\fB-b\fR\fR -.ad -.RS 6n -Precedes each line by the block number on which it was found. This can be -useful in locating block numbers by context (first block is 0). -.RE - -.sp -.ne 2 -.na -\fB\fB-B\fR \fInumber\fR\fR -.ad -.RS 6n -Prints \fInumber\fR input lines of context before each matching line. If there -are multiple matching lines, their context lines are separated by a \fB--\fR +.It Fl b +Precedes each line by the block number on which it was found. +This can be useful in locating block numbers by context (first block is 0). +.It Fl B Ar num +Prints +.Ar num +input lines of context before each matching line. +If there are multiple matching lines, their context lines are separated by a +.Ql -- delimiter line. -.RE - -.sp -.ne 2 -.na -\fB\fB-c\fR\fR -.ad -.RS 6n +.It Fl c Prints only a count of the lines that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-H\fR\fR -.ad -.RS 6n -Precedes each line by the name of the file containing the matching line. -.RE - -.sp -.ne 2 -.na -\fB\fB-e\fR \fIpattern_list\fR\fR -.ad -.RS 6n -Specifies one or more patterns to be used during the search for input. Patterns -in \fIpattern_list\fR must be separated by a NEWLINE character. A null pattern -can be specified by two adjacent newline characters in \fIpattern_list\fR. -Unless the \fB-E\fR or \fB-F\fR option is also specified, each pattern is -treated as a basic regular expression. Multiple \fB-e\fR and \fB-f\fR options -are accepted by \fBgrep\fR. All of the specified patterns are used when -matching lines, but the order of evaluation is unspecified. -.RE - -.sp -.ne 2 -.na -\fB\fB-E\fR\fR -.ad -.RS 6n -Matches using full regular expressions. Treats each pattern specified as a full -regular expression. If any entire full regular expression pattern matches an -input line, the line is matched. A null full regular expression matches every -line. Each pattern is interpreted as a full regular expression as described on -the \fBregex\fR(5) manual page, except for \fB\e(\fR and \fB\e)\fR, and -including: -.RS +4 -.TP -1. -A full regular expression followed by \fB+\fR that matches one or more -occurrences of the full regular expression. -.RE -.RS +4 -.TP -2. -A full regular expression followed by \fB?\fR that matches 0 or 1 -occurrences of the full regular expression. -.RE -.RS +4 -.TP -3. -Full regular expressions separated by | or by a new-line that match strings -that are matched by any of the expressions. -.RE -.RS +4 -.TP -4. -A full regular expression that is enclosed in parentheses \fB()\fR for -grouping. -.RE -The order of precedence of operators is \fB[\|]\fR, then \fB*\|?\|+\fR, then -concatenation, then | and new-line. -.RE - -.sp -.ne 2 -.na -\fB\fB-f\fR \fIpattern_file\fR\fR -.ad -.RS 6n +Overrides +.Fl l . +.It Fl C Ar num Ns \&, Fl Ns Ar num +Prints +.Ar num +input lines of context before and +.Ar number +input lines of context after each matching line. +If there are multiple matching lines, their context lines are separated by a +.Ql -- +delimiter line. +.It Fl e Ar pattern_list +Specifies one or more patterns to be used during the search for input. +Patterns in +.Ar pattern_list +must be separated by a NEWLINE character. +A null pattern can be specified by two adjacent newline characters in +.Ar pattern_list . +Unless the +.Fl E +or +.Fl F +option is also specified, each pattern is treated as a BRE, as described in +.Xr regex 5 . +.It Fl E +Matches using extended regular expressions. +Treats each pattern specified as an ERE, as described in +.Xr regex 5 . +If any entire ERE pattern matches an input line, the line is matched. +A null ERE matches every line. +.It Fl f Ar pattern_file Reads one or more patterns from the file named by the path name -\fIpattern_file\fR. Patterns in \fIpattern_file\fR are terminated by a NEWLINE -character. A null pattern can be specified by an empty line in -\fIpattern_file\fR. Unless the \fB-E\fR or \fB-F\fR option is also specified, -each pattern is treated as a basic regular expression. -.RE - -.sp -.ne 2 -.na -\fB\fB-F\fR\fR -.ad -.RS 6n -Matches using fixed strings. Treats each pattern specified as a string instead -of a regular expression. If an input line contains any of the patterns as a -contiguous sequence of bytes, the line is matched. A null string matches every -line. See \fBfgrep\fR(1) for more information. -.RE - -.sp -.ne 2 -.na -\fB\fB-h\fR\fR -.ad -.RS 6n +.Ar pattern_file . +Patterns in +.Ar pattern_file +are terminated by a NEWLINE character. +A null pattern can be specified by an empty line in +.Ar pattern_file . +Unless the +.Fl E +or +.Fl F +option is also specified, each pattern is treated as a BRE, as described in +.Xr regex 5 . +.It Fl F +Matches using fixed strings. +Treats each pattern specified as a string instead of a regular expression. +If an input line contains any of the patterns as a contiguous sequence of bytes, +the line is matched. +A null string matches every line. +.It Fl h Prevents the name of the file containing the matching line from being prepended -to that line. Used when searching multiple files. -.RE - -.sp -.ne 2 -.na -\fB\fB-i\fR\fR -.ad -.RS 6n +to that line. +Used when searching multiple files. +.It Fl H +Precedes each line by the name of the file containing the matching line. +.It Fl i Ignores upper/lower case distinction during comparisons. -.RE - -.sp -.ne 2 -.na -\fB\fB-l\fR\fR -.ad -.RS 6n +.It Fl l Prints only the names of files with matching lines, separated by NEWLINE -characters. Does not repeat the names of files when the pattern is found more -than once. -.RE - -.sp -.ne 2 -.na -\fB\fB-n\fR\fR -.ad -.RS 6n +characters. +Does not repeat the names of files when the pattern is found more than once. +Overrides +.Fl H . +.It Fl n Precedes each line by its line number in the file (first line is 1). -.RE - -.sp -.ne 2 -.na -\fB\fB-r\fR\fR -.ad -.RS 6n -Read all files under each directory, recursively. Follow symbolic links on -the command line, but skip symlinks that are encountered recursively. If file -is a device, FIFO, or socket, skip it. -.RE - -.sp -.ne 2 -.na -\fB\fB-R\fR\fR -.ad -.RS 6n +.It Fl q +Quiet. +Does not write anything to the standard output, regardless of matching lines. +Exits with zero status if an input line is selected. +Overrides +.Fl c +and +.Fl l . +.It Fl r +Read all files under each directory, recursively. +Follow symbolic links on the command line, but skip symlinks that are +encountered recursively. +If file is a device, FIFO, or socket, skip it. +.It Fl R Read all files under each directory, recursively, following all symbolic links. -.RE - -.sp -.ne 2 -.na -\fB\fB-q\fR\fR -.ad -.RS 6n -Quiet. Does not write anything to the standard output, regardless of matching -lines. Exits with zero status if an input line is selected. -.RE - -.sp -.ne 2 -.na -\fB\fB-\fR\fInumber\fR\fR -.ad -.br -.na -\fB\fB-C\fR \fInumber\fR\fR -.ad -.RS 6n -Prints \fInumber\fR input lines of context before and \fInumber\fR input lines -of context after each matching line. If there are multiple matching lines, -their context lines are separated by a \fB--\fR delimiter line. -.RE - -.sp -.ne 2 -.na -\fB\fB-s\fR\fR -.ad -.RS 6n +.It Fl s Suppresses error messages about nonexistent or unreadable files. -.RE - -.sp -.ne 2 -.na -\fB\fB-v\fR\fR -.ad -.RS 6n +.It Fl v Prints all lines except those that contain the pattern. -.RE - -.sp -.ne 2 -.na -\fB\fB-w\fR\fR -.ad -.RS 6n -Searches for the expression as a word as if surrounded by \fB\e<\fR and -\fB\e>\fR\&. -.RE - -.sp -.ne 2 -.na -\fB\fB-x\fR\fR -.ad -.RS 6n +.It Fl w +Searches for the expression as a word as if surrounded by +.Ql \e< +and +.Ql \e> . +.It Fl x Considers only input lines that use all characters in the line to match an entire fixed string or regular expression to be matching lines. -.RE - -.SH OPERANDS -.LP +.El +.Sh OPERANDS The following operands are supported: -.sp -.ne 2 -.na -\fB\fIfile\fR\fR -.ad -.RS 8n -A path name of a file to be searched for the patterns. If no \fIfile\fR +.Bl -tag -width Ds +.It Ar file +A path name of a file to be searched for the patterns. +If no +.Ar file operands are specified, the standard input is used. -.RE - -.ne 2 -.na -\fB\fIpattern\fR\fR -.ad -.RS 8n -Specifies one or more patterns to be used during the search for input. This -operand is treated as if it were specified as \fB-e\fR \fIpattern_list\fR. -.RE - -.SH USAGE -.LP -The \fB-e\fR \fIpattern_list\fR option has the same effect as the -\fIpattern_list\fR operand, but is useful when \fIpattern_list\fR begins with -the hyphen delimiter. It is also useful when it is more convenient to provide -multiple patterns as separate arguments. -.sp -.LP -Multiple \fB-e\fR and \fB-f\fR options are accepted and \fBgrep\fR uses all of -the patterns it is given while matching input text lines. Notice that the order -of evaluation is not specified. If an implementation finds a null string as a -pattern, it is allowed to use that pattern first, matching every line, and -effectively ignore any other patterns. -.sp -.LP -The \fB-q\fR option provides a means of easily determining whether or not a -pattern (or string) exists in a group of files. When searching several files, -it provides a performance improvement (because it can quit as soon as it finds -the first match) and requires less care by the user in choosing the set of -files to supply as arguments (because it exits zero if it finds a match even if -\fBgrep\fR detected an access or read error on earlier file operands). -.SS "Large File Behavior" -.LP -See \fBlargefile\fR(5) for the description of the behavior of \fBgrep\fR when -encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). -.SH EXAMPLES -.LP -\fBExample 1 \fRFinding All Uses of a Word -.sp -.LP -To find all uses of the word "\fBPosix\fR" (in any case) in the file -\fBtext.mm\fR, and write with line numbers: - -.sp -.in +2 -.nf -example% \fB/usr/bin/grep -i -n posix text.mm\fR -.fi -.in -2 -.sp - -.LP -\fBExample 2 \fRFinding All Empty Lines -.sp -.LP -To find all empty lines in the standard input: - -.sp -.in +2 -.nf -example% \fB/usr/bin/grep ^$\fR -.fi -.in -2 -.sp - -.sp -.LP +.It Ar pattern_list +Specifies one or more patterns to be used during the search for input. +This operand is treated as if it were specified as +.Fl e Ar pattern_list . +Should not be specified if either +.Fl e or - -.sp -.in +2 -.nf -example% \fB/usr/bin/grep -v .\fR -.fi -.in -2 -.sp - -.LP -\fBExample 3 \fRFinding Lines Containing Strings -.sp -.LP -All of the following commands print all lines containing strings \fBabc\fR or -\fBdef\fR or both: - -.sp -.in +2 -.nf -example% \fB/usr/bin/grep 'abc -def'\fR -example% \fB/usr/bin/grep -e 'abc -def'\fR -example% \fB/usr/bin/grep -e 'abc' -e 'def'\fR -example% \fB/usr/bin/grep -E 'abc|def'\fR -example% \fB/usr/bin/grep -E -e 'abc|def'\fR -example% \fB/usr/bin/grep -E -e 'abc' -e 'def'\fR -example% \fB/usr/bin/grep -E 'abc -def'\fR -example% \fB/usr/bin/grep -E -e 'abc -def'\fR -example% \fB/usr/bin/grep -F -e 'abc' -e 'def'\fR -example% \fB/usr/bin/grep -F 'abc -def'\fR -example% \fB/usr/bin/grep -F -e 'abc -def'\fR -.fi -.in -2 -.sp - -.LP -\fBExample 4 \fRFinding Lines with Matching Strings -.sp -.LP -Both of the following commands print all lines matching exactly \fBabc\fR or -\fBdef\fR: - -.sp -.in +2 -.nf -example% \fB/usr/bin/grep -E '^abc$ -^def$'\fR -example% \fB/usr/bin/grep -F -x 'abc -def'\fR -.fi -.in -2 -.sp - -.SH ENVIRONMENT VARIABLES -.LP -See \fBenviron\fR(5) for descriptions of the following environment variables -that affect the execution of \fBgrep\fR: \fBLANG\fR, \fBLC_ALL\fR, -\fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. -.SH EXIT STATUS -.LP +.Fl f +is specified. +.El +.Sh USAGE +Be careful using the characters +.Ql $ , +.Ql * , +.Ql \&[ , +.Ql ^ , +.Ql | , +.Ql \&( , +.Ql \&) , +and +.Ql \e +in the +.Ar pattern_list +because they are also meaningful to the shell. +It is safest to enclose the entire +.Ar pattern_list +in single quotes: +.Li '...' . +.Pp +The +.Fl e Ar pattern +option has the same effect as the +.Ar pattern +operand, but is useful when +.Ar pattern +begins with the hyphen delimiter. +It is also useful when it is more convenient to provide multiple patterns as +separate arguments. +.Pp +Multiple +.Fl e +and +.Fl f +options are accepted and +.Nm +uses all of the patterns it is given while matching input text lines. +Notice that the order of evaluation is not specified. +If an implementation finds a null string as a pattern, it is allowed to use that +pattern first, matching every line, and effectively ignore any other patterns. +.Pp +The +.Fl q +option provides a means of easily determining whether or not a pattern (or +string) exists in a group of files. +When searching several files, it provides a performance improvement (because it +can quit as soon as it finds the first match) and requires less care by the user +in choosing the set of files to supply as arguments (because it exits zero if it +finds a match even if +.Nm +detected an access or read error on earlier file operands). +.Ss Large File Behavior +See +.Xr largefile 5 +for the description of the behavior of +.Nm +when encountering files greater than or equal to 2 Gbyte (2^31 bytes). +.Sh EXIT STATUS The following exit values are returned: -.sp -.ne 2 -.na -\fB\fB0\fR\fR -.ad -.RS 5n +.Bl -tag -width Ds +.It Sy 0 One or more matches were found. -.RE - -.sp -.ne 2 -.na -\fB\fB1\fR\fR -.ad -.RS 5n +.It Sy 1 No matches were found. -.RE - -.sp -.ne 2 -.na -\fB\fB2\fR\fR -.ad -.RS 5n +.It Sy 2 Syntax errors or inaccessible files (even if matches were found). -.RE - -.SH ATTRIBUTES -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: - -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -CSI Enabled -_ -Interface Stability Committed -_ -Standard See \fBstandards\fR(5). -.TE - -.SH SEE ALSO -.LP -\fBegrep\fR(1), \fBfgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1), \fBattributes\fR(5), -\fBenviron\fR(5), \fBlargefile\fR(5), \fBregex\fR(5), \fBregexp\fR(5), -\fBstandards\fR(5) -.SH NOTES -.LP +.El +.Sh EXAMPLES +.Bl -tag -width Ds +.It Sy Example 1 No Finding All Uses of a Word +To find all uses of the word +.Ql Posix +(in any case) in the file +.Pa text.mm , +and write with line numbers: +.Bd -literal +$ grep -i -n posix text.mm +.Ed +.It Sy Example 2 No Finding All Empty Lines +To find all empty lines in the standard input: +.Bd -literal +$ grep ^$ +.Ed +.Pp +or +.Bd -literal +$ grep -v . +.Ed +.It Sy Example 3 No Finding Lines Containing Strings +All of the following commands print all lines containing strings +.Ql abc +or +.Ql def +or both: +.Bd -literal +$ grep 'abc +def' +$ grep -e 'abc +def' +$ grep -e 'abc' -e 'def' +$ grep -E 'abc|def' +$ grep -E -e 'abc|def' +$ grep -E -e 'abc' -e 'def' +$ grep -E 'abc +def' +$ grep -E -e 'abc +def' +$ grep -F -e 'abc' -e 'def' +$ grep -F 'abc +def' +$ grep -F -e 'abc +def' +.Ed +.It Sy Example 4 No Finding Lines with Matching Strings +Both of the following commands print all lines matching exactly +.Ql abc +or +.Ql def : +.Bd -literal +$ grep -E '^abc$ +^def$' +$ grep -F -x 'abc +def' +.Ed +.El +.Sh ENVIRONMENT VARIABLES +See +.Xr environ 5 +for descriptions of the following environment variables that affect the +execution of +.Nm : +.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES , +and +.Ev NLSPATH . +.Sh CODE SET INDEPENDENCE +.Sy Enabled +.Sh INTERFACE STABILITY +.Sy Committed +.Sh SEE ALSO +.Xr sed 1 , +.Xr sh 1 , +.Xr attributes 5 , +.Xr environ 5 , +.Xr largefile 5 , +.Xr regex 5 , +.Xr standards 5 +.Sh STANDARDS +The +.Nm +utility is compliant with the +.St -p1003.1-2008 +specification with the exception of +.Fl s +option being the same as +.Fl q +in current implementation for historic reasons. +The flags +.Op Fl AbBChHrRw +are extensions to that specification. +.Sh NOTES The results are unspecified if input files contain lines longer than -\fBLINE_MAX\fR bytes or contain binary data. \fBLINE_MAX\fR is defined in -\fB/usr/include/limits.h\fR. -.LP -In the past the behavior of \fB/usr/xpg4/bin/grep\fR and -\fB/usr/bin/grep\fR utilities was different. Now \fB/usr/bin/grep\fR -is replaced by \fB/usr/xpg4/bin/grep\fR. +.Dv LINE_MAX +bytes or contain binary data. +.Dv LINE_MAX +is defined in +.In limits.h . +.Pp +Portable applications should use +.Nm Fl E +and +.Nm Fl F +instead of +.Nm egrep +and +.Nm fgrep , +respectively. +.Sh HISTORY +The +.Nm grep +command first appeared in +.At v6 . +.Pp +In the past +.Pa /usr/bin/grep , +.Pa /usr/bin/egrep , +and +.Pa /usr/bin/fgrep +were separate implementations, and were not standard conforming, with standard +conforming ones installed as +.Pa /usr/xpg4/bin/grep , +.Pa /usr/xpg4/bin/egrep , +and +.Pa /usr/xpg4/bin/fgrep , +respectively. +Now all non-conforming implementations are removed, and the ones previously +found in +.Pa /usr/xpg4/bin +are installed in +.Pa /usr/bin . diff --git a/usr/src/pkg/manifests/SUNWcs.man1.inc b/usr/src/pkg/manifests/SUNWcs.man1.inc index 953b83d807..f42294f4cd 100644 --- a/usr/src/pkg/manifests/SUNWcs.man1.inc +++ b/usr/src/pkg/manifests/SUNWcs.man1.inc @@ -11,7 +11,7 @@ # # Copyright 2011, Richard Lowe -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. +# Copyright 2018 Nexenta Systems, Inc. # file path=usr/share/man/man1/Intro.1 @@ -68,7 +68,6 @@ file path=usr/share/man/man1/du.1 file path=usr/share/man/man1/dumpcs.1 file path=usr/share/man/man1/echo.1 file path=usr/share/man/man1/ed.1 -file path=usr/share/man/man1/egrep.1 file path=usr/share/man/man1/eject.1 file path=usr/share/man/man1/encrypt.1 file path=usr/share/man/man1/env.1 @@ -76,7 +75,6 @@ file path=usr/share/man/man1/exec.1 file path=usr/share/man/man1/exit.1 file path=usr/share/man/man1/expr.1 file path=usr/share/man/man1/fdformat.1 -file path=usr/share/man/man1/fgrep.1 file path=usr/share/man/man1/file.1 file path=usr/share/man/man1/find.1 file path=usr/share/man/man1/fmt.1 @@ -221,6 +219,7 @@ link path=usr/share/man/man1/dirname.1 target=basename.1 link path=usr/share/man/man1/dirs.1 target=cd.1 link path=usr/share/man/man1/dumpkeys.1 target=loadkeys.1 link path=usr/share/man/man1/edit.1 target=../../../has/man/man1has/edit.1has +link path=usr/share/man/man1/egrep.1 target=grep.1 link path=usr/share/man/man1/errange.1 target=ckrange.1 link path=usr/share/man/man1/errdate.1 target=ckdate.1 link path=usr/share/man/man1/errgid.1 target=ckgid.1 @@ -236,6 +235,7 @@ link path=usr/share/man/man1/export.1 target=set.1 link path=usr/share/man/man1/false.1 target=true.1 link path=usr/share/man/man1/fc.1 target=history.1 link path=usr/share/man/man1/fg.1 target=jobs.1 +link path=usr/share/man/man1/fgrep.1 target=grep.1 link path=usr/share/man/man1/for.1 target=shell_builtins.1 link path=usr/share/man/man1/foreach.1 target=shell_builtins.1 link path=usr/share/man/man1/function.1 target=shell_builtins.1 |