OT: presence of strings and grep on other OSes

Alex Beamish talexb-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Sep 16 17:39:32 UTC 2005


On 9/16/05, Byron L. Sonne <blsonne-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org> wrote:
> 
> Hey All,
> 
> Not sure where else to turn, so I thought I'd ask you folks. I'm looking
> to dig up information about how much I can rely on the presence of
> strings and grep being present on some of the other unices out there,
> such as AIX, HPUX, DGUX, etc. Older versions too. In some cases, egrep
> is present and grep is not.
> 
> If anyone has any info, I'd love to hear it.


You may be able to access busybox, the "Swiss Army Knife of Embedded Linux". 
Just called busybox with grep as the first argument and go from there. I'm 
looking at the man page for version 1.00-rc1, and the grep that it does is 
documented as follows:

grep
grep [-ihHnqvs] PATTERN [FILEs...]

Search for PATTERN in each FILE or standard input.

Options:

-H prefix output lines with filename where match was found
-h suppress the prefixing filename on output
-i ignore case distinctions
-l list names of files that match
-n print line number with output lines
-q be quiet. Returns 0 if result was found, 1 otherwise
-v select non-matching lines
-s suppress file open/read error messages

Example:

$ grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash
$ grep ^[rR]oo. /etc/passwd
root:x:0:0:root:/root:/bin/bash

That's not all the functionality of the original, but it might be enough for 
you. The strings document is:

strings
strings [-afo] [-n length] [file ... ]

Display printable strings in a binary file.

Options:

-f Precede each string with the name of the file where it was found.
-n N Specifies that at least N characters forms a sequence (default 4)
-o Each string is preceded by its decimal offset in the file.

The bad news is that busybox is new, so may not be on old systems.

Alex

-- 
----------
Linux, Firefox and GMail .. what a combination.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20050916/1d98fe79/attachment.html>


More information about the Legacy mailing list