Hi Well the use of "-" to represent stdin became more or less standard a long time ago, although I guess it was always a "Unix" hack when compared to the POSIX standards. But I am surprised that this is not allowed for in ksh.
Pete On 20 June 2014 17:09, Nathan Weeks <[email protected]> wrote: > The ksh builtin grep apparently doesn't support "-" as an > option-argument to the -f option: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > $ cut -f 1 -d ' ' pattern_file | grep -Ff - file > grep: -: cannot open [No such file or directory] > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > From my interpretation of POSIX.1-2008, it doesn't look like the -f > option is required to support reading the pattern_file from standard > input in the event of an "-" option-argument. bsdgrep (at least the > version in FreeBSD 9.2) and /usr/xpg4/bin/grep from Solaris 11.2-beta > also don't support it, though GNU grep does. > > -- > Nathan Weeks > IT Specialist > USDA-ARS Corn Insects and Crop Genetics Research Unit > Crop Genome Informatics Laboratory > Iowa State University > http://weeks.public.iastate.edu/ > > > > On Fri, Jun 20, 2014 at 11:00 AM, > <[email protected]> wrote: > > Message: 3 > > Date: Fri, 20 Jun 2014 15:54:54 +0100 > > From: Peter Hitchman <[email protected]> > > Cc: AST / Korn Shell Users List <[email protected]> > > Subject: Re: [ast-users] ksh hang on pipeline with builtin cut and > > grep > > Message-ID: > > <CAK7tHSzCpDSiPFSmCCu93DDS6daVoCPe0ih_pjkheLV= > [email protected]> > > Content-Type: text/plain; charset="utf-8" > > > > Hi > > How about instead of /dev/stdin you just use a "-"? > > > > e.g. cut -f 1 -d ' ' pattern_file | grep -Ff - file > > > > Regards > > Pete > > > > > > On 20 June 2014 15:41, Nathan Weeks <[email protected]> wrote: > > > >> I'm seeing a rather odd hang with ksh 2014-06-06 on OS X 10.7.5 when > using > >> the builtin cut and grep in a pipeline: > >> > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> $ type cut > >> cut is a shell builtin version of /usr/bin/cut > >> $ type grep > >> grep is a shell builtin version of /usr/bin/grep > >> $ cat pattern_file > >> x11 x12 > >> $ cat file > >> x11 > >> x21 > >> $ cut -f 1 -d ' ' pattern_file | grep -Ff /dev/stdin file > >> ...hang... > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> > >> Using dtrace to get a stack trace of the ksh process during the hang > >> reveals > >> the following: > >> > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> $ sudo dtruss -sp 7646 > >> Password: > >> SYSCALL(args) = return > >> mmap(0x1E0962C49000, 0x700800000, 0x3, 0x1002, 0xFFFFFFFF, 0x6) > >> = 0x62C49000 0 > >> > >> libsystem_kernel.dylib`__mmap+0xa > >> ksh`_vmsegalloc+0x5b4 > >> ksh`bestpackextend+0x1fb > >> ksh`bestpackalloc+0x379 > >> ksh`bestalloc+0x245 > >> ksh`bestresize+0x7d2 > >> ksh`_ast_realloc+0x117 > >> ksh`_sfexcept+0x3ff > >> ksh`sfwr+0x75a > >> ksh`_sfflsbuf+0x1b5 > >> ksh`sfputr+0x1f8 > >> ksh`addre+0x301 > >> ksh`compile+0x2fe > >> ksh`grep+0xb0f > >> ksh`b_grep+0x1d2 > >> ksh`sh_exec+0x2286 > >> ksh`sh_exec+0x467a > >> ksh`sh_exec+0x53e8 > >> ksh`exfile+0xe5b > >> ksh`sh_main+0x126a > >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> > >> -- > >> Nathan Weeks > >> IT Specialist > >> USDA-ARS Corn Insects and Crop Genetics Research Unit > >> Crop Genome Informatics Laboratory > >> Iowa State University > >> http://weeks.public.iastate.edu/ > >> _______________________________________________ > >> ast-users mailing list > >> [email protected] > >> http://lists.research.att.com/mailman/listinfo/ast-users > >> > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: < > http://lists.research.att.com/pipermail/ast-users/attachments/20140620/609d5536/attachment-0001.html > > > > > > ------------------------------ > > > > _______________________________________________ > > ast-users mailing list > > [email protected] > > http://lists.research.att.com/mailman/listinfo/ast-users > > > > > > End of ast-users Digest, Vol 124, Issue 8 > > ***************************************** >
_______________________________________________ ast-users mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-users
