I am trying find and replace the line one of the existing file, when I am running the below sed command it is replacing all the lines which have the matched string, but instead I want to change only one place inside the file. sed -i 's/azure.com/test.com/' file_name  Actual file server_name azure.com server_name azure.com  Expected result server_name test.com server_name azure.com
I would like to update a large number of C++ source files with an extra include directive before any existing #includes. For this sort of task, I normally use a small bash script with sed to re-write the file.   How do I get sed to replace just the first occurrence of a string in a file rather than replacing every occurrence?  If I use  sed s/#include/#include "newfile.h"\n#include/   it replaces all #includes.   Alternative suggestions to achieve the same thing are also welcome.
Should individual letters be preceded with "an"? I was reading a comic book and I noticed that the author used "an A" and "an N" in a particular phrase (screenshot below). While I understand the usage of "An A" here (A being a vowel and what not) and "N" having a pronunciation which has a sound similar to "A".  Since most of English alphabets have pronunciations which start with a syllable similar to one of the vowels or semi-vowels; is it OK to prefix the letters using "An"?  For eg. An X, or An Y.        Zenescope's Grimm Fairy Tales - Werewolves: The Hunger, page #8 (Click to enlarge) Double Negation in C++ I just came onto a project with a pretty huge code base.   I'm mostly dealing with C++ and a lot of the code they write uses double negation for their boolean logic.    if (!!variable &amp;&amp; (!!api.lookup("some-string"))) {        do_some_stuff();  }                                      I know these guys are intelligent programmers, it's obvious they aren't doing this by accident.   I'm no seasoned C++ expert, my only guess at why they are doing this is that they want to make absolutely positive that the value being evaluated is the actual boolean representation. So they negate it, then negate that again to get it back to its actual boolean value.   Is this correct, or am I missing something? bordermatrix with blocks I need to write a complicated matrix, that has a structure as in the attached picture. How can I split a beamer bibliography across two slides? Complete list of Lollipop system icons shown in notification bar? Is there a complete list of these? I've seen lots of Q&amp;A about "What does x icon mean" but it would be really useful if there were a complete list for reference! Iterate two Lists or Arrays with one ForEach statement in C# How to set a font for math mode? I would like to have something like Segoe UI of something similar. Thank you  \documentclass{article} \usepackage{fontspec} \usepackage{firamath-otf} \begin{document} \begin{equation} x+y=45 \end{equation}  \end{document}   Error: for loop in Java runs 3 times before taking next input Why Doesn't C# Allow Static Methods to Implement an Interface? Why was C# designed this way?  As I understand it, an interface only describes behaviour, and serves the purpose of describing a contractual obligation for classes implementing the interface that certain behaviour is implemented.  If classes wish to implement that behavour in a shared method, why shouldn't they?  Here is an example of what I have in mind:  // These items will be displayed in a list on the screen. public interface IListItem {   string ScreenName();   ... }  public class Animal: IListItem {     // All animals will be called "Animal".     public static string ScreenName() {         return "Animal";     } .... }  public class Person: IListItem {      private string name;      // All persons will be called by their individual names.     public string ScreenName() {         return name;     }      ....   } How to see what's going on during Windows shutdown/logging off process? Windows 7 msconfig lets users select the options No GUI boot and OS boot information to have a list of drivers being loaded during boot. Is it possible to have similar detailed messages during shutting down/restarting/logging off? Here's the screen I want disable or give me more details: Number of elements in the quotient ring $\mathbb{Z}[X]/(X^2-3, 2X+4)$ A secretary with ____ good knowledge of English: "a" or no article? I'm trying to pass a test on "Articles exercise" as they call it . Reviewing my answers I got stuck about the two I posted on the picture below.  As I understand both words are uncountable (according to the ), so it looks like (or said for example ) I can't say a/an with an uncountable noun.  But this test says the opposite. Is there some trick? Or am I just dumb? Please help me to understand why I need to use "a" article in these cases?        We need a secretary with ____ good knowledge of English.          a  (marked as the correct answer)   the     a / the     no article is needed (the answer I think is correct)        We're having ____ terrible weather.         a (marked as the correct answer)     the     a / the     no article is needed (the answer I think is correct) Proving that orthogonal vectors are linearly independent I am trying to prove that $a_1$, $a_2$, $a_3$ are linearly independent.  I am asked to use vector product and prove that if $c_{1}a_{1} + c_{2}a_{2} + c_{3}a_{3} = 0$ then $c_1 = c_2 = c_3 = 0$  I am completely stuck on where to go with this problem. I would think that linearly independent then the null space of the space can only be equal to $0$. Would this prove it? What's the difference between :: (double colon) and -> (arrow) in PHP? I’m struggling with getting \ifmmode to work correctly when used inside an array environment which is inside a displaymath environment.  Here is a minimal example:  \documentclass{article}  \newcommand{\signal}[1]{%   \ifmmode     1#1   \else     2$#1$   \fi }  \begin{document} \begin{displaymath}   \begin{array}{cc}     \signal{a} \signal{b} &amp; \signal{c} \signal{d} \\   \end{array} \end{displaymath} \end{document}   This example generates the following output:        Why doesn’t all invokations of \signal detect math-mode? There is a question I have based on the fact: If you take a quadratic polynomial with integer coefficients, take the set $\{1,2,3,4,5,6,7,8\}$, make a partition $A=\{1,4,6,7\}$, $B=\{2,3,5,8\}$, and then evaluate the polynomial with the elements of each set you got an equality.  If now with a cubic polynomial and the set $\{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\}$, how to pick a suitable partition that accomplish the same fact? I mean is there a general formula for bigger degree? Customizing citations and the list of publications depending on the author Say I use a bibliography file in my document, relying on Biblatex and Biber for citation management.  Given a citation command such as \cite{A, B, C} (or any other standard Biblatex citation command), I'd like the resulting citations to be typeset differently depending on whether a given field (e.g. the author field) in the corresponding bibliography entry contains a given string (e.g. someone's lastname).   Besides, I'd like to generate two different bibliography sections in the resulting document, depending on the same condition as above.  Typically this would be used to differentiate, both at the citation level in the main text and in the appendix, the publications that I co-authored from others.  EDIT: adding a MWE:  \documentclass{article} \usepackage{filecontents} \usepackage[backend=biber,style = alphabetic]{biblatex} \usepackage[colorlinks=true, breaklinks, allcolors = blue]{hyperref} \DeclareSourcemap{%   \maps[datatype=bibtex]{%     \map{%       \step[fieldsource=author, match=Doe, final]%       \step[fieldset=keywords, fieldvalue=doe]%     }%   }% } \begin{filecontents}{\jobname.bib} @Book{p1,   author =       "A. U. Thor and John Doe",   title =        "A Scientific Article 1",   year =         "1975"   } @Book{p2,   author =       "John Doe",   title =        "A Scientific Article 2",   year =         "1985"   } @Book{p3,   author =       "Joe Bar",   title =        "A Scientific Article 3",   year =         "1995"   } @Book{p4,   author =       "Jane Baz",   title =        "A Scientific Article 4",   year =         "2005"   } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} % Requirement 1: should make citations of Doe bold In \parencite{p4, p1, p2, p3}, ``TD75'' and ``Doe85'' should appear in bold (the semicolon should remain plain).  % Requirement 2: separating bibliographies. IT WORKS. \section{Co-authored Publications} \nocite{*} \printbibliography[keyword=doe,heading=none]  \section{Other Publications} \nocite{*} \printbibliography[notkeyword=doe,heading=none]  \end{document} "Print" and "ui.Label" return different strings in console and in the UI in Google Earth Engine I am working on a variable label in Google Earth Engine and noticed that the label as printed in the console is not the same as the label shown on the map. Why is that? Code below:  var aoi = ee.Geometry.Polygon([[[-106.75701284923326, 42.31332966408458],           [-106.75701284923326, 42.003856624775146],           [-106.31755972423326, 42.06913460511273]]]);  var chirpsSelect = ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")             .filterDate('1985-01-01','2018-01-01')             .filter(ee.Filter.dayOfYear(3,6))             .filterBounds(aoi)  var chirpsStartImage = ee.String(chirpsSelect.first().get('system:index')) var dateStartString = ((((chirpsStartImage.slice(6,8)).cat('/')).cat(chirpsStartImage.slice(4,6))).cat('/')).cat(chirpsStartImage.slice(2,4))   var sortChirpsSelect = chirpsSelect.sort('system:index',false)  var chirpsEndImage = ee.String(sortChirpsSelect.first().get('system:index')) var dateEndString = ((((chirpsEndImage.slice(6,8)).cat('/')).cat(chirpsEndImage.slice(4,6))).cat('/')).cat(chirpsEndImage.slice(2,4)) var dateTitle = ee.String((dateStartString.cat(' to ')).cat(dateEndString))  print(dateTitle)  var dateLabel = ui.Label({   value: dateTitle })  var panel = ui.Panel() panel.add(dateLabel) Map.add(panel) How To Reduce Noise In Cycles Render If I type something like this:  {\itshape\LARGE   Dunt venim dolorerosto do odit   ametum vulla conum dolore   conulput in vero od el   Dunt venim dolorerosto do odit   ametum vulla conum dolore   conulput in vero od el }   it results in a block of 4 lines with narrow spacing between the 1st and 2nd line and between the 3rd and 4th line. Line spacing between the 2nd and 3rd line is normal.  I can't fully explaing it to myself so I am looking for a short description for this behaviour. I know for example that with a \par at the end of the text (inside the group), the calculation would correct. But I have no idea why...