Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
On Tue, 09 Aug 2022 20:25:50 +0200, Janis Papanagnou wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Closed, cannot reproduce
14:32 $ strings <(zcat ./cat.gz) | grep comment
.comment
On Tue, 09 Aug 2022 20:25:50 +0200, Janis Papanagnou wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Closed, cannot reproduce
14:32 $ strings <(zcat ./cat.gz) | grep comment
.comment
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
On 2022-08-09, Janis Papanagnou <[email protected]> wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
There may have been an underlying rationale that executable format
parsing involves seeking rather than a linear read through the file.
But on my system, the strings command will read from stdin, though the synopsis on the man page doesn't directly say so:
SYNOPSIS
strings [-afovV] [-min-len]
[SNIP]
[--help] [--version] file...
Using "file..." rather than "[file]..." implies that there must be at
least one file name argument, but that appears to be inaccurate:
$ echo hello | strings
hello
$
The DESCRIPTION section does talk about strings reading from stdin (and changing behavior)
On 2022-08-09, Janis Papanagnou <[email protected]> wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Think that it's not there because POSIX doesn't require it, I checked
POSIX. In POSIX, I found this:
"If the first argument is '-', the results are unspecified."
Aha, so implementations of strings are permitted (encouraged, I might
say) to support standard in reading via the - convention.
The wording probably exists because some strings implementations
do and some do not?
The strings from GNU Bintutils 2.30 does handle stdin---and does not
like the - argument; go figure.
On Tue, 09 Aug 2022 20:25:50 +0200, Janis Papanagnou wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Closed, cannot reproduce
14:32 $ strings <(zcat ./cat.gz) | grep comment
.comment
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/strings.html :
strings [-a] [-t format] [-n number] [file...]
On 2022-08-09, Janis Papanagnou <[email protected]> wrote:
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Think that it's not there because POSIX doesn't require it, I checked
POSIX. In POSIX, I found this:
"If the first argument is '-', the results are unspecified."
Aha, so implementations of strings are permitted (encouraged, I might
say) to support standard in reading via the - convention.
POSIX specifies -a which tells strings to scan the file in its entirety. Otherwise what part of a file is scanned is implementation-defined.
GNU binutils strings makes that the default,
probably because that's the behavior you almost always want.
file
A pathname of a regular file to be used as input. If no file
operand is specified, the strings utility shall read from the
standard input.
Lew Pitcher <[email protected]> writes:[snip]
On Tue, 09 Aug 2022 20:25:50 +0200, Janis Papanagnou wrote:
Thanks to process substitution in newer shells I can write, e.g.,
strings <( zcat file.gz ) | ...
I am wondering, though, whether there's a reason why 'strings' is
not defined to support (additionally) filter calling semantics
...(binary stream)... | strings | ...(text stream)...
Closed, cannot reproduce
14:32 $ strings <(zcat ./cat.gz) | grep comment
.comment
The reported problem is that the strings command does not read from its standard input. The command you tried is the one that Janis said
works. `<(zcat ./cat.gz)` will expand to something like "/dev/fd/63",
which is passed as a file name argument.
I find it unusual that Janis' version of strings(1) does /not/ default
to stdin/stdout. Or, perhaps he didn't try it?
On 2022-08-09, Kaz Kylheku <[email protected]> wrote:
POSIX specifies -a which tells strings to scan the file in its entirety.
Otherwise what part of a file is scanned is implementation-defined.
GNU binutils strings makes that the default,
It does not. You can do what I just did and compare the respective
output.
GNU binutils strings makes that the default,
Sorry, I should have clarified is that what what is default is the -a,
$ strings -h
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)
The options are:
-a - --all Scan the entire file, not just the data section [default]
On 2022-08-11, Kaz Kylheku <[email protected]> wrote:
GNU binutils strings makes that the default,
Sorry, I should have clarified is that what what is default is the -a,
That's what I understood and disagreed with.
$ strings -h
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)
The options are:
-a - --all Scan the entire file, not just the data section [default]
So that default has changed, because...
$ strings /usr/bin/make |wc
1163 2871 20472
$ strings -a /usr/bin/make |wc
1188 2896 20698
$ strings --version
GNU strings (GNU Binutils for Debian) 2.22
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 17:54:45 |
| Calls: | 12,103 |
| Calls today: | 3 |
| Files: | 15,004 |
| Messages: | 6,518,078 |