You are not logged in. Login Now
 0-15   15-37         
 
Author Message
23 new of 37 responses total.
papa
response 15 of 37: Mark Unseen   Mar 1 04:47 UTC 2017

I don't think you can do it with one grep command. You
have to check each line of widgets for no match.

In bash or sh, something like this should work:

cat widgets |while read w; do grep -q $w widgetlist; if
test $? -eq 1; then echo $w; fi done

That runs grep for each line in widgets & detects no match
by checking for exit code ($?) of 1.
papa
response 16 of 37: Mark Unseen   Mar 1 04:52 UTC 2017

Same code "pretty-printed" instead of one-lined:

cat widgets | while read w
  do
    grep -q $w widgetlist
    if [ $? -eq 1 ]
      then
        echo $w
      fi
  done

unicorn
response 17 of 37: Mark Unseen   Mar 1 05:39 UTC 2017

Actually, that's what the -f option is for, but if you're looking for
the widgets that aren't in the file instead of the ones that are, you
need to use -v with it:

    grep -vf widgets widgetlist

If you use the -v and -f together, make sure the v comes before the f,
since widgets is an argument for the -f option.  If you use -fv, you'll
be grepping for the letter v in both files, which isn't what you want.

You could also use:

    grep -v -f widgets widgetlist

or

    grep -f widgets -v widgetlist
unicorn
response 18 of 37: Mark Unseen   Mar 1 06:04 UTC 2017

I just reread resp:14, and I think you want the reverse of what I said.
It should be:

    grep -vf widgetlist widgets

That will find which lines are in widgets that aren't in widgetlist.
kentn
response 19 of 37: Mark Unseen   Mar 1 16:49 UTC 2017

The unix comm command will also tell you whnt lines are in common or not
between two sorted lists (files).  Lots of options (e.g. in one list and
not the other).
unicorn
response 20 of 37: Mark Unseen   Mar 2 03:17 UTC 2017

I also misstated what -fv would do, if mistakenly used instead of -vf.
I said it would grep for the letter v, but it would actually look for
a pattern file called v to find its patterns to match.  Sorry for the
confusion.
tod
response 21 of 37: Mark Unseen   Mar 4 04:54 UTC 2017

re #16 
super thanks

re #19
How would you script that?
Hadn't thought of comm
kentn
response 22 of 37: Mark Unseen   Mar 5 02:00 UTC 2017

Here is an example:
  widgets:
    widget1
    widget2
    widget3
    widget8

  widgetlist:
    widget1
    widget2
    widget3
    widget4
    widget5
    widget6
    widget7

  #Print only lines present in both file1 and file2.
  comm -12 widgets widgetlist
  widget1
  widget2
  widget3

  #Print lines in file1 not in file2, and vice versa
  comm -3 widgets widgetlist
          widget4
          widget5
          widget6
          widget7
  widget8

Scripting might include sorting the two lists, but the comm
command itself is pretty easy.

deejoe
response 23 of 37: Mark Unseen   May 30 00:15 UTC 2017

 The Debian package 'moreutils' has a command 'combine' that apparently can
be used for this sort of thing. It's probably available for other systems,
or from source (of course).

cross
response 24 of 37: Mark Unseen   May 30 00:53 UTC 2017

`moreutils` is actually the GNU package name. I added it on grex.
ryan
response 25 of 37: Mark Unseen   Nov 11 12:58 UTC 2018

often times `less` is `more`

walkman
response 26 of 37: Mark Unseen   Sep 25 11:20 UTC 2019

We can be heroes. Just for fifteen minutes.
https://tinyurl.com/y3oscsgm
walkman
response 27 of 37: Mark Unseen   Oct 5 23:06 UTC 2019

https://www.youtube.com/watch?v=WrHldIbkeZw
tod
response 28 of 37: Mark Unseen   Oct 12 05:03 UTC 2019

re #26
She Called Aspergers Her Superpower
Each Parent Organ Grinders
https://www.youtube.com/watch?v=5zLU_6nBc4E
walkman
response 29 of 37: Mark Unseen   Oct 21 16:40 UTC 2019

The idea that we must prop up a mentally ill teenage girl as an 
authority on climate science is so fundamentally absurd. 
Then again, she is also being propped up like a climate messiah. 
Does that work for all 16 year old girls? 
Where does one apply to speak to the UN Assembly?

https://tinyurl.com/y2kw6rew
cross
response 30 of 37: Mark Unseen   Oct 21 17:42 UTC 2019

I found her annoying. Doesn't mean she's wrong, though. The
science really is settled; she's just pissed in a weird way
that people don't take that seriously.
tod
response 31 of 37: Mark Unseen   Oct 24 02:20 UTC 2019

It would have been more powerful if Axl Rose said it
walkman
response 32 of 37: Mark Unseen   Oct 27 21:42 UTC 2019

"The science really is settled"

That's quite the contradiction. 
At any rate, now that it's a closed case, it's time to end funding for
climate research.
papa
response 33 of 37: Mark Unseen   Oct 28 21:31 UTC 2019

resp:30

--> item:environment:47
papa
response 34 of 37: Mark Unseen   Apr 22 22:19 UTC 2021

[Performs a ritual summoning the spirits of Backtalk to return.]
rak
response 35 of 37: Mark Unseen   Apr 24 14:18 UTC 2021

[pop]

I guess this spirit can appear and make his first ever backtalk post.
I looked through many of the conferences and archives, and I really 
wish backtalk were as active as it once was.

I am curious to see usage stats for grex and backtalk these days.
`last` reveals the same handful of users most times I check it,
 while ps shows that about a dozen non-system accounts have jobs
running.

Also: someone should perhaps write a cron job that kills abandoned
pnewuser processes. There are 34 of them still running going back
to January.

[poof]
papa
response 36 of 37: Mark Unseen   Apr 27 00:44 UTC 2021

resp:35
I didn't think that would actually work!
;)
walkman
response 37 of 37: Mark Unseen   Apr 29 15:24 UTC 2021

"So we go inside and we gravely read the stones
All those people, all those lives, where are they now?
With-a loves and hates and passions just like mine
They were born, and then they lived, and then they died
Seems so unfair, I want to cry" ~ Morrissey
 0-15   15-37         
Response Not Possible: You are Not Logged In
 

- Backtalk version 1.3.30 - Copyright 1996-2006, Jan Wolter and Steve Weiss