G-Man Says 'Reinstate Monica'

Jul 13, 2020 05:59
@Archemar’s answer indicates (perhaps not as precisely as yours) that the ! operator is applied to the value of a[$0] before it is incremented – which is correct, since it’s a post-increment. Strictly speaking, the order of operations is indeterminate; !aaa++ is equivalent to temp=aaa; aaa++; !temp, but it’s also equivalent to temp=!aaa; aaa++; temp.
 
Jan 3, 2020 18:05
(4) You said, “Back in the late 90's SU was the place to post things.”  Actually, no; Super User didn’t exist in the late 90s.
Jan 3, 2020 18:05
(1) You say, “I copied a text file, not created by root or PhotoRec, to the exfat partition. Windows still doesn't see any files there.”  This says that the problem has nothing to do with PhotoRec, and so about 50% of your question is irrelevant.  (2) FYI, permissions problems cause permissions errors; they do not cause files to be invisible.  (3) I hate to insult your intelligence, but are you sure that you’re looking at the same partition in Linux and in Windows?  How?  Can you show us what you’re doing, in more detail, that makes you believe this?
 
Jun 9, 2019 02:13
(Cont’d) …  (5) OK, I don’t want to bombard mkzia with notifications about stuff not related to their answer. But I don’t want them to be told that their answer “only works by chance” — by a ♦ moderator — when it is just as good as the others. (6) Leaving comments under your answer wouldn’t have made any sense. I wasn’t critiquing your answer (except to the extent that I was critiquing all of the answers, except for user000001’s); I was critiquing your critique of mkzia’s answer.
Jun 9, 2019 02:11
(Cont’d) …  (4) “Why would you assume the OP would want the 2nd proto as well as the first?”  Counterpoint: why would you assume that they don’t?  That seems like one of the many follow-up / clarification questions that should have been asked of the OP. … (Cont’d)
Jun 9, 2019 02:11
(Cont’d) …  (3) You say, “the post quite clearly states that the values will always be one of tcp/http, tcp/https, udp/dns.”  Well, the question is just all kinds of unclear.  I interpreted that sentence as meaning “I need to extract the value of proto from input that is formatted like the above example.  The output I’m expecting from the above (example) data is tcp/http, tcp/https, udp/dns.”   … (Cont’d)
Jun 9, 2019 02:11
(Cont’d) …  Overly narrow / specific answers risk not really helping the OP.   (2b) Stack Exchange’s purpose is to build a knowledge base; a repository of high-quality questions and definitive answers that will be applicable and useful to others in the future.   To teach people how to fish, rather than to hand out fish sandwiches.   Overly narrow / specific answers are less likely to be useful to others.   … (Cont’d)
Jun 9, 2019 02:11
(1) You’re playing games with words.  [tc,ud]*p doesn’t match ppp; it matches p three times (as can be seen in the output you present).  Compare your little demonstration to echo xyzuucp | grep -o "[tc,ud]*p".  Or try echo "proto=ppp/dns sent=144" | grep -o "[tc,ud]*p".  (2) Why generalize?  (2a) It seems to happen fairly often that people post answers that work for the sample data only, and the OP comes back and says “That doesn’t work for my real data.”  … (Cont’d)
Jun 8, 2019 22:21
@terdon: Do you mean my comments critiquing your comments?  Because that seems to be way too narrow in scope for Meta.   Or do you mean the larger issue of answers that address the example data only?  I suppose I agree that that should be discussed widely.
Jun 8, 2019 22:21
(Cont’d) …  My point is, I believe that, to be correct, an answer should find proto= anywhere on the line, and match/extract the following string of printing characters.  By that standard, user000001’s answer is the only one that’s right.  But the community seems to accept a lower standard.  By that standard, mkzia’s answer is fine, because it works for the provided input data.  Sure, it reflects a misunderstanding of how […] works, and it could be reduced to [tucd]*p, but that really isn’t any worse than ..p. … (Cont’d)
Jun 8, 2019 22:21
(Cont’d) …  P.S. @mkzia: You don’t need the \ before the / (i.e., you can reduce the \/ to /).
Jun 8, 2019 22:21
(Cont’d) …  assume that proto= is the first thing on the line, and that the proto value is always tcp/something or udp/something.  Kusalananda offers an answer that assumes that something matches [[:alnum:]]* (counterexamples: ftp-data is a standard name for port 20; netbios-ns, netbios-dgm, netbios-ssn, dhcpv6-client and dhcpv6-server are also standard service names). … (Cont’d)
Jun 8, 2019 22:21
(Cont’d) …  bu5hman’s answer assumes that the network protocol (the part before the /) matches ..p; Wikipedia offers counterexamples DCCP, RSVPSCTP and SPX.  Freddy’s answer assumes that the proto will be the only value on the line that contains a /. … (Cont’d)
Jun 8, 2019 22:21
@terdon: (1) No, actually it won’t match ppp.  Of course you’re right that it will match ,p or tp — or uucp, ttp, cutp, ductp or d,up. (2) I have been banging my head against the wall for years over questions where the question describes a problem, and then gives an example of the input, and people post answers that work for example, but not the general problem, as described.  For example, most of the answers here — including yours — … (Cont’d)
Jun 8, 2019 22:21
@Jesse_b: While mkzia is not technically a “New contributor”, they are an inexperienced user, as evidenced by the fact that they didn’t use code formatting for their command.  And yet they were smart enough to type \* to get the first * in their command to appear as an * and not as italics markdown.  When you put the command into code format, you caused the \ before the * to appear (thus causing the command to fail).  When you edit other people’s posts, please watch out for changing the appearance of the post like this.
 
Mar 28, 2018 14:16
(Cont’d) …  or the Plain Text Tables generator site if you want.  You should probably post a couple of customer records (input and output), but, for the sake of illustration, pretend that the input records range between 8 and 10 rows.  Don’t paste so many columns that a row of your data doesn’t fit on a line of text.  (Of course don’t post any real, sensitive data.)
Mar 28, 2018 14:16
(Cont’d) …  But if the first customer type might be in B5 or B7, how do you tell? (3) Is it one field per column, or might there be another field in B18 (±1)? (4) Even if you believe that “providing a visual of what the data looks like” is essential to explaining your problem clearly, please don’t post images of text.  Post a textual representation of your data, as was done here and here; use the Format Text as Table … (Cont’d)
Mar 28, 2018 14:16
(1) First of all, I guess you’re reading the customer information report directly into Excel (by copy and paste?) and then trying to reduce from 23 to 25 lines/rows per record (customer) to one row per record (customer). It would have been nice to state that explicitly. (2) Use words to describe your problem more clearly. OK, input records are variable-length, delimited by a 1 in Column A. Let’s put that aside for a moment, and pretend all input records are 25 lines/rows long. If the customer types were in cells B6, B31, B56, B81, B106, etc., this wouldn’t be too hard. … (Cont’d)
 
Feb 24, 2015 02:50
(3) Your last four big text blocks are ipconfig (failure), ipconfig (success), route print (success), and route print (failure). This is a non-parallel order, which is confusing. (4) Seriously? The wired network has a default gateway that doesn't exist, and you don't think that's worth mentioning or investigating?
Feb 24, 2015 02:50
(1) The question title says, "Cannot ping 10.0.0.105/24 from 10.0.0.2/24". If you want to ping 10.0.0.105 from 10.0.0.2, that means you want 10.0.0.2 and 10.0.0.105 to communicate. (2) When somebody points out a typo in your post, you should not just reply with a comment saying, "Yes, that's a typo"; you should fix the typo.
Feb 24, 2015 02:50
@Werner and TOOGAM: You raise the possibility that the failure to ping may be caused by a firewall. How is this consistent with the fact that the problem goes away by itself (i.e., pings start working) after a while (the OP mentions "an hour")?
Feb 24, 2015 02:50
Worse, you’re a little fuzzy on explaining how 10.0.0.2 and 10.0.0.105 are supposed to communicate. I presume that the two computers are connected to the Buffalo switch with Ethernet cables. You mention that there are “other machines on the wired network”. Can you ping them from 10.0.0.2? If not, then the answer is probably what you already know: the network is flaky. And what is 10.0.0.254? (It might be worthwhile to edit this information into your question.) Finally, are your two route print outputs in the right order?
Feb 24, 2015 02:50
You seem to have some crossed wires (figuratively): Your second paragraph says, “One card (Ethernet 3) [is] configured as 10.0.0.2. …. Ethernet 4 [is] configured as 10.1.1.2.” But your third paragraph and your ifconfig output say the opposite.
 

 /dev/chat

General discussion for unix.stackexchange.com. If you have a q...
Oct 8, 2014 00:40
@slm (1) -name "*.pyc" – deferred wildcards should be quoted. (2) Either -delete or -exec rm {} +, but not what you said.
Oct 6, 2014 23:29
@terdon: Find a file which is 30 minutes old and Finding a file which created X minutes back (without GNU/BSD find) (which were asked one week apart by the same user) both discuss fine-grained time-based searches in find.
Oct 6, 2014 21:08
I missed the starting gun. Are we submitting questions that might be duplicates of the new “What are the shell's control and redirection operators?” canonical question? Here’s one that popped up just a few days ago: When is 'if' not necessary?