Grep the lines between the occurrence of the same pattern I would like to grep the lines between the same occurrence of a pattern and then save each matching lines in a different file. For example, I have this:  name aaa bbb bbb ccc name aaa1 bbb1 ccc1 name ...   I would like to have   name aaa bbb bbb ccc   in file1  name aaa1 bbb1 ccc1   in file 2, and so on.  I tried with a flag inversion in awk like that:  awk '/^name/ {flag=!flag; next} flag {print}'   but I'm not getting what I want.  Do you have any suggestion to do that?
Split file into multiple files based on pattern I have a large file that's a couple hundred lines long. This file is partitioned into many parts by a specific identifier, lets say 'ABC'. This line 'ABC' appears 6 times so I want 6 output files. I'm familiar with split and awk but can't seem to create a command line that will do what I've described, any ideas?  Here's an example  ABC line 1 line 2 line 3 ABC line 1 line 2 ABC line1   I'd like three files where ABC is the first line in the new file and it ends before the next ABC is encountered.
SQL to find the number of distinct values in a column Given the functional dependencies of a relation is there more then one way to normalize it? Consider a set $A$ of $10$ integers, $A = \{a_1,a_2, \ldots ,a_{10}\}$. Prove that there is at least one subset of $A$ whose sum is divisible by $10$. Allow diamond moderators to reverse question migrations? It has happened on occasion, due to the high amount of 10K moderators on SO that questions are migrated to the wrong site, and needs to be reversed. Although currently it is possible to re-open the question on the original site and delete the one on the destination site, it still leave the migrated too banner behind.  It would be useful if diamond moderators could reverse a migration, removing it from the destination site completely and re-activating it on the original site and at the same time removing the banners.  Previously it has been discussed educating the users around when to move questions, however this doesn't stop the problem.  As per Shog9  I have to admit I do like Shog9's suggestion regarding the post being closed as not programming related rather then re-opened, however, reasons for closing it on other sites should also be kept in mind, as this also applies to stuff being sent back forth between the sites. What do bookcases do for enchanting? What is the mysterious stranger doing in my vault? Suppose f is a function such that $f'(x) = \frac{1}{x}$ for all $x &gt; 0$. Prove that if $f(1) = 0, then f(xy) = f(x) + f(y)$ for all $x,y &gt; 0$  As stated above, how do i go about doing this question?   Hi all, i would like to apologize if the question is missing context or other details.   This question was part of my calculus tutorial. I was on the topic of application of differentiation when this question was given to me.  Thus far i have learnt about intermediate value theorem, mean value theorem, rolle's theroem, Fermat's thereom.  As of this point in my learning, i have not touched upon integration. The only reason why i accepted the answer with integration in it was because i understood it.  Thus i believe i am suppose to use one the few theorems that i've stated to solve this question. But i have no idea where to start.  At first i differentiated the equation $f(xy)=f(x)+f(y)$ with respect to x  i believed the answer to be $f'(xy)\frac{dy}{dx}=f'(x)+f'(y)\frac{dy}{dx}$  which would be $\frac{1}{xy}\frac{1}{x}=\frac{1}{x}+\frac{1}{y}\frac{1}{x}$  At this point a few questions came to my mind  1) am i suppose to differentiate the eqn in the first place 2) what has $f(1)=0$ got to do with anything 3) what theorem am i suppose to use to solve this question  This was my thought process throughout the question and i hope someone would point out my mistakes. Thank you When should I implement IDisposable? How to add startup applications in lubuntu? Bugged display in search using negation I have been trying to make a short clip of a bullet hitting a wine glass with wine in it, but I keep running into the same problem with the add-on. Every time I have used it the result has left me with at least a partial box being generated as several of the fractured pieces.  I have tried subdividing and/or adding a sub-surf modifier but the result only changes where the large distorted fragments end up. I have been having trouble with this for quite some time and I would greatly appreciate any help. PC started having screen glitches after update I'm not sure what's caused it. I haven't changed any system settings. The only thing I've done that may have broken something is updating my software. My update was: upgrade linux-generic-hwe-20.04:amd64 5.8.0.48.54~20.04.32 5.8.0.49.55~20.04.33 upgrade linux-image-generic-hwe-20.04:amd64 5.8.0.48.54~20.04.32  upgrade linux-headers-generic-hwe-20.04:amd64 5.8.0.48.54~20.04.32  upgrade linux-image-extra-virtual:amd64 5.4.0.70.73 5.4.0.71.74 upgrade linux-image-generic:amd64 5.4.0.70.73 5.4.0.71.74 upgrade linux-libc-dev:amd64 5.4.0-70.78 5.4.0-71.79 upgrade libseccomp2:amd64 2.4.3-1ubuntu3.20.04.3 2.5.1-1ubuntu1~20.04.1 upgrade nomachine:amd64 7.3.2-3 7.4.1-3```  Removing nomachine did not solve the problem. It was far worse before, I'm not sure how to describe exactly, but my entire screen's UI was glitching out. So I rebooted and that stopped, but now the terminal text looks like this:  I haven't changed any terminal settings. This seems to be occurring in the entire OS. Here is another example:  Not sure how to go about troubleshooting this? I don't have the time to reinstall the OS, nor do I think I should have to because this is just ridiculous and shouldn't happen. I'm not aware of anything I've done to make the system unstable. Edit Earlier I also tried booting the PC. It failed and got stuck on some command in a terminal (didn't manage to take a photo of what it said). So I rebooted into recovery mode with both available kernels. I was getting strange glitches like this:  That didn't work. So I rebooted the PC normally, and now I somehow logged in fine. Now I'm getting popups saying to report a system error. It says this:  Environment  Ubuntu 20.04.2 LTS GNOME 3.36.8  sudo lshw -class display   *-display        description: VGA compatible controller        product: Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller        vendor: Intel Corporation        physical id: 2        bus info: pci@0000:00:02.0        version: 06        width: 64 bits        clock: 33MHz        capabilities: msi pm vga_controller bus_master cap_list rom        configuration: driver=i915 latency=0        resources: irq:33 memory:f7800000-f7bfffff memory:e0000000-efffffff ioport:f000(size=64) memory:c0000-dffff  I also did , which passed with 0 errors. Let me know if more details are required. How does Ethernet know how long a frame is? Can you combine multiple lists with LINQ? Say I have two lists:  var list1 = new int[] {1, 2, 3}; var list2 = new string[] {"a", "b", "c"};   Is it possible to write a LINQ statement that will generate the following list:  var result = new []{      new {i = 1, s = "a"},     new {i = 1, s = "b"},     new {i = 1, s = "c"},     new {i = 2, s = "a"},     new {i = 2, s = "b"},     new {i = 2, s = "c"},     new {i = 3, s = "a"},     new {i = 3, s = "b"},     new {i = 3, s = "c"} };   ?  Edit: I forgot to mention I didn't want it in query syntax. Anyway, based on preetsangha's answer I've got the following:  var result = list1.SelectMany(i =&gt;  list2.Select(s =&gt; new {i = i, s = s})); Check for missing fonts/characters in XeLaTeX? Opportunity attack when moving in and out of range of a creature in the same move? Let's say I'm 10ft away from an enemy. In my turn, I choose to move 5ft to get close enough to attack, I do attack, then I use my remaining movement to move out of range of the enemy. Does this still allow them an opportunity attack? Linux kernel update stuck I just installed a new kernel on Ubuntu GNOME 17.04 that came in through the normal updates. However, it is now stuck for a while on the following line:  Setting up linux-headers-4.10.0-20-generic (4.10.0-20.22) ... Examining /etc/kernel/header_postinst.d. run-parts: executing /etc/kernel/header_postinst.d/dkms 4.10.0-20-generic /boot/vmlinuz-4.10.0-20-generic   Something seems to hang the process. Does someone know what could cause this?  EDIT: This is the content of /boot as requested:  abi-4.10.0-19-generic     grub                          System.map-4.10.0-19-generic abi-4.10.0-20-generic     initrd.img-4.10.0-19-generic  System.map-4.10.0-20-generic config-4.10.0-19-generic  memtest86+.bin                vmlinuz-4.10.0-19-generic config-4.10.0-20-generic  memtest86+.elf                vmlinuz-4.10.0-19-generic.efi.signed efi                       memtest86+_multiboot.bin      vmlinuz-4.10.0-20-generic   EDIT 2: Just tried purging the new kernel but got this:  E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.   Using that command returns me to the original problem. I am stuck now :( What is the joint distribution of $Z=\min(X,Y)$ and $I_{Z=X}$? Assume that $X$ and $Y$ are independent random variables with $X \sim \exp(\lambda)$ and $Y \sim \exp(\mu)$. It is impossible to obtain direct observations of $X$ and $Y$. Instead, we observe the random variables $Z$ and $W$, where $Z = \min\{X,Y\}$ and $W =1$ if $Z=X$ and $W=0$ if $Z=Y$.  How to find the joint distribution of $Z$ and $W$? Direct Link to a Comment What's the opposite word for "sin"? I would like to know if there is an opposite word for sin in English.  I mean, how could I say the opposite of     I committed a sin   other than using a negation?