Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-20 Thread Michael
another excellent example why your posts are almost always worth reading. thank you! :)

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread Greg Wooledge
On Thu, Jan 19, 2023 at 02:00:00PM +0100, DdB wrote: > Am 19.01.2023 um 13:13 schrieb Greg Wooledge: > > The fact that this *appears* to work is what causes so much confusion. > > It will "work" some of the time, but not all of the time, and you'll > > get different results depending on which direc

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread tomas
On Thu, Jan 19, 2023 at 02:00:00PM +0100, DdB wrote: [...] > I was really curious, how Greg would put words to this one. And i gotta > applaud: Such unambiguous explanations, and so circumspect at the same > time. Even understanding the basis for confusion, i could learn > something new from this

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread DdB
Am 19.01.2023 um 13:13 schrieb Greg Wooledge: > The fact that this *appears* to work is what causes so much confusion. > It will "work" some of the time, but not all of the time, and you'll > get different results depending on which directory you're in, on which > computer. > > Bash has two other

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread tomas
On Thu, Jan 19, 2023 at 07:13:46AM -0500, Greg Wooledge wrote: [...] > So, just to add to the list of people who've already said it: always > quote the patterns that you pass to apt list, because you want apt > to use them directly, without your shell interfering. And, if in doubt, just replace

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread Greg Wooledge
d globs. The first one is called "nullglob", and if it's turned on, an unmatched glob is simply discarded from the command argument list. unicorn:~$ bash unicorn:~$ shopt | grep glob dotglob off extglob off failgloboff globasciiranges on globstaroff noc

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread Christoph Brinkhaus
llo together, > > > listing packages in apt with ”sudo“ in the title returns different output > > > (bash commands at the end of the email). I would fill a bug report, but > > > I'm not sure whether to address it to grep or apt. How do you see this? > > >

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread tomas
ash commands at the end of the email). I would fill a bug report, but I'm > > not sure whether to address it to grep or apt. How do you see this? > > > > Kind regards > > Julian Schreck > > -- > > $ apt list sudo* vs. $ apt list | grep "^sudo[a-z-]

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread Christoph Brinkhaus
Am Thu, Jan 19, 2023 at 09:10:30AM +0100 schrieb js-p...@online.de: Hello Julian, > Hello together, > listing packages in apt with ”sudo“ in the title returns different output > (bash commands at the end of the email). I would fill a bug report, but I'm > not sure whether to a

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread Markus Schönhaber
19.01.23, 09:10 +0100, js-p...@online.de: Hello together, listing packages in apt with ”sudo“ in the title returns different output (bash commands at the end of the email). I would fill a bug report, but I'm not sure whether to address it to grep or apt. How do you see this? To me it

Re: reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread DdB
Am 19.01.2023 um 09:10 schrieb js-p...@online.de: > Hello together, > listing packages in apt with ”sudo“ in the title returns different output > (bash commands at the end of the email). I would fill a bug report, but I'm > not sure whether to address it to grep or apt. Ho

reportbug: don't know: bug in apt [list] or in grep

2023-01-19 Thread js-priv
Hello together, listing packages in apt with ”sudo“ in the title returns different output (bash commands at the end of the email). I would fill a bug report, but I'm not sure whether to address it to grep or apt. How do you see this? Kind regards Julian Schreck -- $ apt list sudo* vs.

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread David
On Wed, 21 Dec 2022 at 04:18, Lee wrote: > On 12/20/22, David wrote: > > $ echo -e '100:CD001\nXXX\n200:CD001' | awk 'BEGIN { FS=":" ; done=0 } > > /CD001/ && done==0 { print $1 - 50 ; done=1 }' > > 50 > > You can do it without flags: > > $ echo -e '100:CD001\nXXX\n200:CD001' | awk -F: '/CD001/

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread Lee
On 12/20/22, David wrote: > On Tue, 20 Dec 2022 at 22:04, David wrote: >> On Tue, 20 Dec 2022 at 22:02, David wrote: > >> > $ echo -e '100:CD001\n200:CD001' | awk 'BEGIN { FS=":" } /CD001/ && >> > NR==1 { print $1 - 50 }' >> > 50 >> >> Oops, my mistake, that's not the solution. Give me another m

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread Stefan Monnier
> Not that that is always important. But I just commented today > because so often 'awk' is ignored as if its only capability is 'print $1' > when in fact it is actually very powerful but neglected. FWIW, `sed` can also do that job. Tho the subtraction part would take a lot more work (`sed` does

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread David
On Tue, 20 Dec 2022 at 22:04, David wrote: > On Tue, 20 Dec 2022 at 22:02, David wrote: > > $ echo -e '100:CD001\n200:CD001' | awk 'BEGIN { FS=":" } /CD001/ && > > NR==1 { print $1 - 50 }' > > 50 > > Oops, my mistake, that's not the solution. Give me another minute and I > will post a better one

Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game)

2022-12-20 Thread Thomas Schmitt
Hi, The Wanderer wrote: > With the '-o' option, grep prints only the parts of the line that were > matched - but the plural here is very relevant. If that guess is > correct, then the "line" in question has *four* occurrences, so grep > prints them all - each on

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread David
On Tue, 20 Dec 2022 at 22:02, David wrote: > $ echo -e '100:CD001\n200:CD001' | awk 'BEGIN { FS=":" } /CD001/ && > NR==1 { print $1 - 50 }' > 50 Oops, my mistake, that's not the solution. Give me another minute and I will post a better one one.

Re: use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread David
On Tue, 20 Dec 2022 at 21:53, The Wanderer wrote: > On 2022-12-20 at 05:37, David wrote: > > On Tue, 20 Dec 2022 at 21:10, The Wanderer wrote: > >> On 2022-12-20 at 02:51, Thomas Schmitt wrote: > >>> This contradicts the promises of man grep about option -m. >

use of awk instead of complex multielement commands (was Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game))

2022-12-20 Thread The Wanderer
On 2022-12-20 at 05:37, David wrote: > On Tue, 20 Dec 2022 at 21:10, The Wanderer > wrote: > >> On 2022-12-20 at 02:51, Thomas Schmitt wrote: >>> This contradicts the promises of man grep about option -m. >> >> It does seem to, at least at a glance - bu

Re: 'grep -o -m' (was Re: Can't mount CD image of Win95 game)

2022-12-20 Thread David
On Tue, 20 Dec 2022 at 21:10, The Wanderer wrote: > On 2022-12-20 at 02:51, Thomas Schmitt wrote: > >>> offst=$( expr \ > >>> $( grep -a -o -b -m 1 CD001 cdimage.iso \ > >>> | sed -e 's/:/ /' \ > >>>

'grep -o -m' (was Re: Can't mount CD image of Win95 game)

2022-12-20 Thread The Wanderer
On 2022-12-20 at 02:51, Thomas Schmitt wrote: > Hi, > > i wrote: >>> To obtain the offset of the first occurence of "CD001", do >>> >>> offst=$( expr \ >>> $( grep -a -o -b -m 1 CD001 cdimage.iso \ >>>

Re: Exploring grep-dctrl

2022-11-30 Thread Yassine Chaouche
Le 11/30/22 à 4:02 PM, Yassine Chaouche a écrit : But even then, translation files might contain more than one entry for same package, maybe one for each (version x architecture) product. For eg.: $ grep-dctrl winbind -s Description-en /var/lib/apt/lists

Re: Exploring grep-dctrl

2022-11-30 Thread Yassine Chaouche
2 at 17:25:45 (+0100), Yassine Chaouche wrote: I tried to achieve the same w/o using apt-cache, but couldn't. My failed attempts were : 1/ 16:37:50 ~ -1- $ grep-dctrl -PX syslog-summary /var/lib/apt/lists/*_Packages Thos

Re: Exploring grep-dctrl

2022-11-29 Thread David Wright
Please don't post HTML, but text. On Sun 27 Nov 2022 at 17:25:45 (+0100), Yassine Chaouche wrote: > I tried to achieve the same w/o using apt-cache, but couldn't. > > My failed attempts were : > > > 1/ > 16:37:5

Exploring grep-dctrl

2022-11-27 Thread Yassine Chaouche
Hello there, I am exploring the possibilities of grep-dctrl. My current experiment is to try and show the description of a package that is not necessarily installed. I have defined a package.describe function in my .bashrc that does

Re: grep replacement using sed is behaving oddly

2022-10-22 Thread Max Nikulin
On 22/10/2022 20:23, Gary Dale wrote:     sed -i '//d' *.html did the trick. I would suggest you to use more specific pattern to avoid removing of meaningful text due to a lost newline character: sed -i -e '/^\s*]*>\s*$/d' "." in regexp may be a source of surprises (or catastrophic backtr

Re: grep replacement using sed is behaving oddly

2022-10-22 Thread Gary Dale
ginning of a word. '\>' Matches the end of a word. but it's next to impossible to keep track of whether you're in a section that's speaking POSIX, GNU, or some mid-20th century tradition. I feel obliged at this point to mention that parsing HTML with regular e

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Sat, Oct 22, 2022 at 10:32:24AM +0700, Max Nikulin wrote: > On 22/10/2022 02:09, The Wanderer wrote: > > > > 'info sed', section 'sed regular expressions', subsection 'regular > > expression extensions': > > While a reader may find more interesting stuff lying around while traveling > by this

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Max Nikulin
On 22/10/2022 02:09, The Wanderer wrote: 'info sed', section 'sed regular expressions', subsection 'regular expression extensions': While a reader may find more interesting stuff lying around while traveling by this path, there is a shorthand info "(sed) regexp extensions" and alternatives

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread The Wanderer
On 2022-10-21 at 16:16, Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 03:09:32PM -0400, The Wanderer wrote: > >> IOW, each seems to be half of the usual '\b' (edge of a word) set. >> With the default sed behavior (not sure whether that's basic >> regular expressions or extended regular expressio

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
On Fri, Oct 21, 2022 at 03:09:32PM -0400, The Wanderer wrote: > IOW, each seems to be half of the usual '\b' (edge of a word) set. With > the default sed behavior (not sure whether that's basic regular > expressions or extended regular expressions, in the nomenclature of the > info document), you c

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread David Wright
or whatever might really help. As it is, unless you're looking at a real book, you get a table like: '\s' Matches whitespace characters (spaces and tabs). Newlines embedded in the pattern/hold spaces will also match: '\S' Matches non-whit

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread The Wanderer
On 2022-10-21 at 14:15, Greg Wooledge wrote: > So... yeah, \< and/or \> clearly have some special meaning to GNU > sed. Good luck figuring out what that is. 'info sed', section 'sed regular expressions', subsection 'regular expression extensions': >> '\<' >> Matches the beginning of a word.

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
o-width string between the last non-word character and the first word character ("<") and that one between the last word character and the following non-word character (">"). PCRE has those, too. > For Gary's actual problem, simply removing the backslashes where t

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
uck figuring out what that is. For Gary's actual problem, simply removing the backslashes where they're not wanted would be a good start. Actually learning sed could be step 2. I feel obliged at this point to mention that parsing HTML with regular expressions is a fool's errand, and that sed should not be the tool of choice here. Nor should grep, nor any other RE-based tool. This goes triple when one doesn't even know the correct syntax for their RE. https://stackoverflow.com/q/1732348

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Fri, Oct 21, 2022 at 01:50:29PM -0400, Greg Wooledge wrote: > On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > >  sed -i -s 's/\s*\//g' history.html > > > > Unfortunately, the replacement doesn't remove the line but rather leaves me > > with: > > > >     <;"> > > The 's' c

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread tomas
On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: > I'm hoping someone can tell me what I'm doing wrong. I have a line in a lot > of HTML files that I'd like to remove. The line is: > >     > > I'm testing the sed command to remove it on just one file. When it works, > I'll run

Re: grep replacement using sed is behaving oddly

2022-10-21 Thread Greg Wooledge
On Fri, Oct 21, 2022 at 01:21:44PM -0400, Gary Dale wrote: >  sed -i -s 's/\s*\//g' history.html > > Unfortunately, the replacement doesn't remove the line but rather leaves me > with: > >     <;"> The 's' command in sed doesn't remove lines. It performs a substitution within a line. T

grep replacement using sed is behaving oddly

2022-10-21 Thread Gary Dale
I'm hoping someone can tell me what I'm doing wrong. I have a line in a lot of HTML files that I'd like to remove. The line is:     I'm testing the sed command to remove it on just one file. When it works, I'll run it against *.html. My command is:  sed -i -s 's/\s*\//g' history.ht

Re: grep: show matching line from pattern file

2022-06-03 Thread DdB
Hello, of course, there are different ways to solve this, i like the perl approach. Only since i myself am not all that familiar with the language, i'd like to add 2 pointers: (M)AWK scripting language can do similar things (read syslog once, loop over regular expressions and output anything you w

Re: grep: show matching line from pattern file

2022-06-03 Thread Richard Hector
On 3/06/22 07:17, Greg Wooledge wrote: On Thu, Jun 02, 2022 at 03:12:23PM -0400, duh wrote: > > Jim Popovitch wrote on 28/05/2022 21:40: > > > I have a file of regex patterns and I use grep like so: > > > > > > ~$ grep -f patterns.txt /var/log/syslog >

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread David Christensen
On 6/2/22 22:50, Will Mengarini wrote: * David Christensen [22-06/02=Th 19:18 -0700]: [...] Now I can almost match your prompt -- there is a dash before 'bash': 2022-06-02 19:05:10 dpchrist@laalaa ~ $ PS1="\\h/${TTY#/dev/} \\s$SHLVL \\w \\A \$?\\\$" laalaa/pts/8 -bash1 ~ 19:08 0$ The dash see

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread Will Mengarini
* David Christensen [22-06/02=Th 19:18 -0700]: > [...] > Now I can almost match your prompt -- there is a dash before 'bash': > > 2022-06-02 19:05:10 dpchrist@laalaa ~ > $ PS1="\\h/${TTY#/dev/} \\s$SHLVL \\w \\A \$?\\\$" > laalaa/pts/8 -bash1 ~ 19:08 0$ > > The dash seems to be coming from the '\s

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread David Christensen
PS1: 2022-06-02 17:39:09 dpchrist@laalaa ~ $ grep PS1 .profile export PS1='\n\D{%Y-%m-%d %H:%M:%S} '${USER}'@\h \w\n\$ ' Variable expansions *are* performed when PS1 is evaluated. So, you could simply do: PS1='stuff $USER more stuff' That will delay the expansio

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread Greg Wooledge
17:39:09 dpchrist@laalaa ~ > $ grep PS1 .profile > export PS1='\n\D{%Y-%m-%d %H:%M:%S} '${USER}'@\h \w\n\$ ' Variable expansions *are* performed when PS1 is evaluated. So, you could simply do: PS1='stuff $USER more stuff' That will delay the expansion of U

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread David Christensen
On 6/2/22 18:35, Will Mengarini wrote: * David Christensen [22-06/02=Th 18:01 -0700]: On 6/2/22 17:12, Will Mengarini wrote: * David Christensen [22-06/02=Th 15:50 -0700]: On 6/2/22 15:13, Will Mengarini wrote: In this transcript, the number before the prompt-ending '$' is $?:

Re: Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread Will Mengarini
y driver: > > 2022-06-02 17:38:55 dpchrist@laalaa ~ > $ cat /etc/debian_version ; uname -a ; dpkg-query -W bash > 11.3 > Linux laalaa 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 > GNU/Linux > bash 5.1-2+b3 > > This is my PS1. '\u' does not wor

Bash and the PS1 environment variable [was: grep: show matching line from pattern file]

2022-06-02 Thread David Christensen
5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 GNU/Linux bash5.1-2+b3 This is my PS1. '\u' does not work on all of Debian, FreeBSD, Cygwin, and macOS, so the expansion of ${USER} is inserted between two string literals when .profile runs and sets PS1:

Re: grep: show matching line from pattern file

2022-06-02 Thread Will Mengarini
* David Christensen [22-06/02=Thu 15:50 -0700]: > On 6/2/22 15:13, Will Mengarini wrote: >> * Greg Wooledge [22-05/28=Sa 17:11 -0400]: >>> [...] >>> #!/usr/bin/perl >>> use strict; use warnings; >>> [...] >>> open PATS, ">> [...] >> >> You need "or die", not "|| die", because of precedence: what

Re: grep: show matching line from pattern file

2022-06-02 Thread David Christensen
On 6/2/22 15:13, Will Mengarini wrote: * Greg Wooledge [22-05/28=Sa 17:11 -0400]: [...] #!/usr/bin/perl use strict; use warnings; [...] open PATS, " You need "or die", not "|| die", because of precedence: what you coded checks whether " +1 That is a good explanation of a Perl fine point/ go

Re: grep: show matching line from pattern file

2022-06-02 Thread Will Mengarini
* Greg Wooledge [22-05/28=Sa 17:11 -0400]: > [...] > #!/usr/bin/perl > use strict; use warnings; > [...] > open PATS, " [...] You need "or die", not "|| die", because of precedence: what you coded checks whether " perl -le"print unpack '%C*',MENGARINI"

Re: grep: show matching line from pattern file

2022-06-02 Thread Greg Wooledge
On Thu, Jun 02, 2022 at 03:12:23PM -0400, duh wrote: > > > Jim Popovitch wrote on 28/05/2022 21:40: > > > > I have a file of regex patterns and I use grep like so: > > > > > > > > ~$ grep -f patterns.txt /var/log/syslog > > > >

Re: grep: show matching line from pattern file

2022-06-02 Thread duh
On 5/29/22 9:44 AM, David Wright wrote: On Sun 29 May 2022 at 15:02:35 (+0200), Jörg-Volker Peetz wrote: Jim Popovitch wrote on 28/05/2022 21:40: Not exactly Debian specific, but hoping that someone here can help. I have a file of regex patterns and I use grep like so: ~$ grep -f

Re: grep: show matching line from pattern file

2022-05-29 Thread Jim Popovitch
On Sat, 2022-05-28 at 17:11 -0400, Greg Wooledge wrote: > On Sat, May 28, 2022 at 04:02:39PM -0400, The Wanderer wrote: > > On 2022-05-28 at 15:40, Jim Popovitch wrote: > > > I have a file of regex patterns and I use grep like so: > > > > > >    ~$

Re: grep: show matching line from pattern file

2022-05-29 Thread David Wright
On Sun 29 May 2022 at 15:02:35 (+0200), Jörg-Volker Peetz wrote: > Jim Popovitch wrote on 28/05/2022 21:40: > > Not exactly Debian specific, but hoping that someone here can help. > > > > I have a file of regex patterns and I use grep like so: > > > > ~$ gre

Re: grep: show matching line from pattern file

2022-05-29 Thread Jörg-Volker Peetz
Jim Popovitch wrote on 28/05/2022 21:40: Not exactly Debian specific, but hoping that someone here can help. I have a file of regex patterns and I use grep like so: ~$ grep -f patterns.txt /var/log/syslog What I'd like to get is a listing of all lines, specifically the line numbers o

Re: grep: show matching line from pattern file

2022-05-28 Thread The Wanderer
On 2022-05-28 at 17:11, Greg Wooledge wrote: > On Sat, May 28, 2022 at 04:02:39PM -0400, The Wanderer wrote: > >> On 2022-05-28 at 15:40, Jim Popovitch wrote: >> > I have a file of regex patterns and I use grep like so: >> > >> >~$ grep -f patterns.t

Re: grep: show matching line from pattern file

2022-05-28 Thread Greg Wooledge
On Sat, May 28, 2022 at 04:02:39PM -0400, The Wanderer wrote: > On 2022-05-28 at 15:40, Jim Popovitch wrote: > > I have a file of regex patterns and I use grep like so: > > > >~$ grep -f patterns.txt /var/log/syslog > > > > What I'd like to get is a

Re: grep: show matching line from pattern file

2022-05-28 Thread The Wanderer
On 2022-05-28 at 15:40, Jim Popovitch wrote: > Not exactly Debian specific, but hoping that someone here can help. > > I have a file of regex patterns and I use grep like so: > >~$ grep -f patterns.txt /var/log/syslog > > What I'd like to get is a listing of a

grep: show matching line from pattern file

2022-05-28 Thread Jim Popovitch
Not exactly Debian specific, but hoping that someone here can help. I have a file of regex patterns and I use grep like so: ~$ grep -f patterns.txt /var/log/syslog What I'd like to get is a listing of all lines, specifically the line numbers of the regexps in patterns.txt, that

Re: sometimes i go huh (grep result)

2018-08-27 Thread songbird
Greg Wooledge wrote: > On Mon, Aug 27, 2018 at 10:36:12AM -0400, songbird wrote: >> me@ant(25)$ env | grep -F "-g" >> grep: invalid option -- 'g' > > You want either -- or -e. > > grep -F -- -g > grep -F -e -g i just found it interestin

Re: sometimes i go huh (grep result)

2018-08-27 Thread Joe Pfeiffer
What's tripping you up is that some processing is being done by the shell before grep ever sees your pattern. Taking that into account, what grep is seeing is: songbird writes: > me@ant(25)$ env | grep -F "-g" grep -F -g > grep: invalid option -- 'g' > Usa

Re: sometimes i go huh (grep result)

2018-08-27 Thread Roberto C . Sánchez
On Mon, Aug 27, 2018 at 11:26:12AM -0400, Greg Wooledge wrote: > On Mon, Aug 27, 2018 at 11:20:42AM -0400, Roberto C. Sánchez wrote: > > env |grep [-]g > > Fails if there is a file named -g in the current directory, as that > matches the unquoted glob and causes it to expa

Re: sometimes i go huh (grep result)

2018-08-27 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Aug 27, 2018 at 11:19:25AM -0400, Greg Wooledge wrote: > On Mon, Aug 27, 2018 at 10:36:12AM -0400, songbird wrote: > > me@ant(25)$ env | grep -F "-g" > > grep: invalid option -- 'g' > > You want eith

Re: sometimes i go huh (grep result)

2018-08-27 Thread Nicolas George
songbird (2018-08-27): > me@ant(25)$ env | grep -F "-g" > grep: invalid option -- 'g' Maybe what you want is an explanation rather than just a solution. Quotes are for the shell: they protect arguments that contain special characters, so that commands get them as is.

Re: sometimes i go huh (grep result)

2018-08-27 Thread Greg Wooledge
On Mon, Aug 27, 2018 at 11:20:42AM -0400, Roberto C. Sánchez wrote: > env |grep [-]g Fails if there is a file named -g in the current directory, as that matches the unquoted glob and causes it to expand. Also fails if failglob is turned on, whether the file exists or not (fails differently

Re: sometimes i go huh (grep result)

2018-08-27 Thread Roberto C . Sánchez
On Mon, Aug 27, 2018 at 10:36:12AM -0400, songbird wrote: > me@ant(25)$ env | grep -F "-g" > grep: invalid option -- 'g' > Usage: grep [OPTION]... PATTERN [FILE]... > Try 'grep --help' for more information. > me@ant(26)$ env | grep -F '-g&#x

Re: sometimes i go huh (grep result)

2018-08-27 Thread Greg Wooledge
On Mon, Aug 27, 2018 at 10:36:12AM -0400, songbird wrote: > me@ant(25)$ env | grep -F "-g" > grep: invalid option -- 'g' You want either -- or -e. grep -F -- -g grep -F -e -g

sometimes i go huh (grep result)

2018-08-27 Thread songbird
me@ant(25)$ env | grep -F "-g" grep: invalid option -- 'g' Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. me@ant(26)$ env | grep -F '-g' grep: invalid option -- 'g' Usage: grep [OPTION]... PATTERN [FILE]... Try &

Re: Little question grep

2017-01-08 Thread John L. Ries
That strikes me as being just a touch too complex for grep. It may well be doable, but you'll probably have an easier time using AWK (possibly not what you wanted to hear, but it's well worth learning). The object of the game would be to count the number of signs on each line and

Re: Little question grep

2017-01-08 Thread Reco
On Sun, 8 Jan 2017 12:40:34 +0300 Reco wrote: > or, if you need whole words (i.e. need to exclude spaces): > > egrep '^[^ ]$' file1 Self-edit. Of course it's: egrep '^[^ ]{5}$' file1 Reco

Re: Little question grep

2017-01-08 Thread Reco
Hi. On Sun, 08 Jan 2017 10:11:26 +0100 Hans wrote: > Hi all, > > I have a little problem with using grep. > > The problem: > > I have a wordlist with 3,5 Mio words in ASCII. No I want filter out all words > with 5,6, > 7, 8, 9 and 10 signs in seperate l

Little question grep

2017-01-08 Thread Hans
Hi all, I have a little problem with using grep. The problem: I have a wordlist with 3,5 Mio words in ASCII. No I want filter out all words with 5,6, 7, 8, 9 and 10 signs in seperate lists. The wordlist contains all sort of signs, like alphanumeric, control signs like "^", &quo

Re: When do I use perl, awk, sed, grep, cut etc.. Was[OT] get all devices from a vendor from pci.ids

2017-01-06 Thread Javier Barroso
e:]]/ { /^[^[:space:]]/d ; p >> }' /usr/share/misc/pci.ids >> >> Wrapping to script which get an argument is easy >> >> Regards >> > > Thanks for your answer, and the next question pops in. > > Is there a "rule" when I use perl, awk, sed, grep, c

When do I use perl, awk, sed, grep, cut etc.. Was[OT] get all devices from a vendor from pci.ids

2017-01-06 Thread Floris
quot;vendor" " {p=1;} p' /usr/share/misc/pci.ids With sed: sed -ne '/^0e11/p' -e '/^0e11/,/^[^[:space:]]/ { /^[^[:space:]]/d ; p }' /usr/share/misc/pci.ids Wrapping to script which get an argument is easy Regards Thanks for your answer, and the next question p

Re: Charsets v grep

2015-11-15 Thread Martin Str|mberg
In article R. Clayton wrote: > and I've been getting a lot of this lately: > $ grep ^Subject: cbtm > Binary file cbtm matches > whereas before (a month or so ago) I used to get actual matches on std-out. > It's easy enough to work around like so > $ sed

Charsets v grep

2015-11-15 Thread R. Clayton
en getting a lot of this lately: $ grep ^Subject: cbtm Binary file cbtm matches $ whereas before (a month or so ago) I used to get actual matches on std-out. It's easy enough to work around like so $ sed -n -e '/^Subject:/p' < cbtm Subject: Re: PTFACULTY: FTFACUL

Re: Usage of grep - Was: no .bash_hostory file was found in user home folder

2013-10-20 Thread Ralf Mardorf
s "better" and it can matter. I guess I used ls too often with grep instead of only using ls , until somebody mentioned it. I guess such "mistakes" should be mentioned on open mailing lists. Next time somebody googles for grep s/he shouldn't find an less good example b

Re: Usage of grep - Was: no .bash_hostory file was found in user home folder

2013-10-19 Thread Markus Falb
On 20.Okt.2013, at 00:51, Ralf Mardorf wrote: > > > On Sun, 2013-10-20 at 03:42 +0500, Muhammad Yousuf Khan wrote: >>cat /etc/passwd | grep ykhan >>ykhan:x:19000:19000:ykhan,,,:/home/ykhan:/bin/bash > > [rocketmouse@archlinux ~]$ grep rocketmouse

Usage of grep - Was: no .bash_hostory file was found in user home folder

2013-10-19 Thread Ralf Mardorf
On Sun, 2013-10-20 at 03:42 +0500, Muhammad Yousuf Khan wrote: > cat /etc/passwd | grep ykhan > ykhan:x:19000:19000:ykhan,,,:/home/ykhan:/bin/bash [rocketmouse@archlinux ~]$ grep rocketmouse /etc/passwd rocketmouse:x:1000:1000::/home/rocketmouse:/bin/bash IOW if you us

Re: apt-cache --names-only search apm | grep sleepd. Is there a bug?

2011-05-05 Thread Camaleón
On Thu, 05 May 2011 05:10:53 -0700, Regid Ichira wrote: > $ apt-cache --names-only search apm | grep sleepd > sleepd - puts an inactive or low battery laptop to sleep > > Am I right that, according to man apt-cache, mentioning sleepd is a bug? (...) Yep, well... kind of. Alre

apt-cache --names-only search apm | grep sleepd. Is there a bug?

2011-05-05 Thread Regid Ichira
$ apt-cache --names-only search apm | grep sleepd sleepd - puts an inactive or low battery laptop to sleep Am I right that, according to man apt-cache, mentioning sleepd is a bug? $ man apt-cache | grep -A20 ' search regex' | head search reg

Re: Off topic question about grep

2010-11-09 Thread ~Stack~
p with a command line like this: >> >> $ grep [_a-zA-Z][_a-zA-Z0-9]file1 file2 file3 ... > The shell will expand the above into space separated values, based on > matches to the glob pattern. The first match will become the pattern > used by grep, searched for in the remaining file nam

Re: Off topic question about grep

2010-11-09 Thread Bob McGowan
ht I >> wanted it to do. What is puzzling to me is that my hard disk usage >> peaked, my cpu jumped, and grep took almost two minutes to return an >> exit code of 1 (no match). :-/ > > What was your exact command line? Did you quote the regular expression? > My guess is

Re: Off topic question about grep

2010-11-09 Thread Paul E Condon
On 20101109_071001, ~Stack~ wrote: > Hello everyone! > > I ran into a strange issue with grep and I was hoping someone could > explain what I feel is an oddity. > > I was trying to match a word that starts with either a _ or a letter > followed by any number of _, letters,

Re: Off topic question about grep

2010-11-09 Thread Jochen Schulz
isk usage > peaked, my cpu jumped, and grep took almost two minutes to return an > exit code of 1 (no match). :-/ What was your exact command line? Did you quote the regular expression? My guess is that the shell interpreted the '*' character for you and you ended up with a command li

Off topic question about grep

2010-11-09 Thread ~Stack~
Hello everyone! I ran into a strange issue with grep and I was hoping someone could explain what I feel is an oddity. I was trying to match a word that starts with either a _ or a letter followed by any number of _, letters, or numbers. (eg: Good = Asdf1, _aSD1. Bad: 9_asD ). My test text file

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-18 Thread Alexander Batischev
On Fri, Sep 17, 2010 at 11:07:53PM -0600, Bob Proulx wrote: > Albretch Mueller wrote: > But newer POSIX standard find can use a {} + to launch grep once and > to pass as many files on the command line as the system allows. That > is faster since grep is launched only as many tim

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Bob Proulx
Albretch Mueller wrote: > $ find -name '*.extension' -exec grep -H 'pattern' {} \; Using {} \; is the old way. That invokes grep once per file. That works but is slower and less efficient than it could be because it takes a little bit of time to launch grep. But newer

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Stephen Powell
On Fri, 17 Sep 2010 14:08:18 -0400 (EDT), Albretch Mueller wrote: > > I need to: >~ search for files using a pattern (say all files with a certain extension) >~ then search inside each of the found files for a word or regexp pattern >~ You could do this using find, ca

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Alexander Batischev
On Fri, Sep 17, 2010 at 06:32:06PM +, Albretch Mueller wrote: > > if you need certain extension, you don't even need cat and find, it's all > > about grep: > > > $ grep 'string' *.extension > ~ > The thing is that I need to know in whi

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Joe Brenner
Albretch Mueller wrote: > I need to: > ~ > search for files using a pattern (say all files with a certain extension) > ~ > then search inside each of the found files for a word or regexp pattern > ~ > You could do this using find, cat and grep in a script, but I was

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Albretch Mueller
> if you need certain extension, you don't even need cat and find, it's all > about grep: > $ grep 'string' *.extension ~ The thing is that I need to know in which file the pattern was found and as you guys suggested: ~ $ find -name '*.extension' -

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Camaleón
On Fri, 17 Sep 2010 18:08:18 +, Albretch Mueller wrote: > I need to: > ~ > search for files using a pattern (say all files with a certain > extension) > ~ > then search inside each of the found files for a word or regexp pattern > ~ > You could do this using find,

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Alexander Batischev
and find, it's all about grep: $ grep 'string' *.extension > ~ > then search inside each of the found files for a word or regexp pattern But if you really want to use find, here's something you may try: $ find -name '*.extension' -exec grep -H 'pattern&#

Re: searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Axel Freyn
Hi Albrecht, On Fri, Sep 17, 2010 at 06:08:18PM +, Albretch Mueller wrote: > search for files using a pattern (say all files with a certain extension) > then search inside each of the found files for a word or regexp pattern > You could do this using find, cat and grep in a scri

searching inside files with find, cat and grep as a oneliner ...

2010-09-17 Thread Albretch Mueller
I need to: ~ search for files using a pattern (say all files with a certain extension) ~ then search inside each of the found files for a word or regexp pattern ~ You could do this using find, cat and grep in a script, but I was wondering about how could you do it with a oneliner ~ Thanks

Re: match across line using grep

2010-08-19 Thread Bob Proulx
Zhang Weiwu wrote: > Bob McGowan wrote: > > My point is that changing only the LANG environment variable changed the > > way 'grep' dealt with the newline character. > > You are right this really look like a problem. Where should I file the > bug? The gnu proje

Re: match across line using grep

2010-08-19 Thread Zhang Weiwu
On 2010年08月07日 06:41, Bob McGowan wrote: > My point is that changing only the LANG environment variable changed the > way 'grep' dealt with the newline character. You are right this really look like a problem. Where should I file the bug? The gnu projects management looks

  1   2   3   4   5   6   >