How printf handles empty linesWhere has the trailing newline char gone from my command substitution?Setting...
Graduate student with abysmal English writing skills, how to help
Why doesn't sea level show seasonality?
Storming Area 51
How many hours would it take to watch all of Doctor Who?
During copyediting, journal disagrees about spelling of paper's main topic
Why didn't Nick Fury expose the villain's identity and plans?
What prevents someone from claiming to be the murderer in order to get the real murderer off?
Keep milk (or milk alternative) for a day without a fridge
Does throwing a penny at a train stop the train?
How to properly say "bail on somebody" in German?
Does Lufthansa weigh your carry on luggage?
As the Dungeon Master, how do I handle a player that insists on a specific class when I already know that choice will cause issues?
Would dual wielding daggers be a viable choice for a covert bodyguard?
For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?
Modulus Operandi
Why are they 'nude photos'?
Are there any sports for which the world's best player is female?
Why isn't there research to build a standard lunar, or Martian mobility platform?
What is a solution?
Cracking the Coding Interview — 1.5 One Away
How were Martello towers supposed to work?
Optimization terminology: "Exact" v. "Approximate"
Can fluent English speakers distinguish “steel”, “still” and “steal”?
Was I subtly told to resign?
How printf handles empty lines
Where has the trailing newline char gone from my command substitution?Setting the column position in printfbash prevent printf from interrupting another printfUsing printf to round 49.765 to 49.77?printf thousand separator not working on MacBookprintf “$V” fails when it's: '^+%&/%+^Order of printf?I think printf broke my newlines in terminalHow to printf literal characters from/to file in bash?printf command in bashUse dash in printf
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Starting from:
$ cat bib/10.2307_2983885.txt
@article{10.2307/2983885,
ISSN = {00359246},
URL = {http://www.jstor.org/stable/2983885},
abstract = {The essence of many statistical problems, including most standard techniques, is to test whether or not the unknown parameters of an appropriate statistical model satisfy certain restrictions; and the outcome of such a test dictates whether it is necessary to provide estimates of these parameters which also satisfy the restrictions. In this paper we discuss and illustrate the relative merits, as practical tools for the consulting statistician, of two large-sample techniques of wide applicability to such situations: (i) unrestricted maximum-likelihood estimation with its associated Wald test, (ii) restricted maximum-likelihood estimation with its associated Lagrange-multiplier test. The discussion falls into two main sections corresponding to two methods of specifying restrictions, as constraint equations in the parameters, or as freedom equations expressing the parameters in terms of a second smaller set of parameters. The methods are modified by a simple device to apply to the case where constraints on the parameters are necessary to allow their identification.},
author = {J. Aitchison and S. D. Silvey},
journal = {Journal of the Royal Statistical Society. Series B (Methodological)},
number = {1},
pages = {154--171},
publisher = {[Royal Statistical Society, Wiley]},
title = {Maximum-Likelihood Estimation Procedures and Associated Tests of Significance},
volume = {22},
year = {1960}
}
Notice there is an empty line after the last }. I now try to recombine different parts:
$ printf "%bn" "$(cat bib/10.2307_2983885.txt | head -n1)" "$(cat bib/10.2307_2983885.txt | head -n -2 | tail -n +2)" "$(cat bib/10.2307_2983885.txt | tail -n -2)"
The output I get drops the last empty line. Why is that?
newlines printf
add a comment |
Starting from:
$ cat bib/10.2307_2983885.txt
@article{10.2307/2983885,
ISSN = {00359246},
URL = {http://www.jstor.org/stable/2983885},
abstract = {The essence of many statistical problems, including most standard techniques, is to test whether or not the unknown parameters of an appropriate statistical model satisfy certain restrictions; and the outcome of such a test dictates whether it is necessary to provide estimates of these parameters which also satisfy the restrictions. In this paper we discuss and illustrate the relative merits, as practical tools for the consulting statistician, of two large-sample techniques of wide applicability to such situations: (i) unrestricted maximum-likelihood estimation with its associated Wald test, (ii) restricted maximum-likelihood estimation with its associated Lagrange-multiplier test. The discussion falls into two main sections corresponding to two methods of specifying restrictions, as constraint equations in the parameters, or as freedom equations expressing the parameters in terms of a second smaller set of parameters. The methods are modified by a simple device to apply to the case where constraints on the parameters are necessary to allow their identification.},
author = {J. Aitchison and S. D. Silvey},
journal = {Journal of the Royal Statistical Society. Series B (Methodological)},
number = {1},
pages = {154--171},
publisher = {[Royal Statistical Society, Wiley]},
title = {Maximum-Likelihood Estimation Procedures and Associated Tests of Significance},
volume = {22},
year = {1960}
}
Notice there is an empty line after the last }. I now try to recombine different parts:
$ printf "%bn" "$(cat bib/10.2307_2983885.txt | head -n1)" "$(cat bib/10.2307_2983885.txt | head -n -2 | tail -n +2)" "$(cat bib/10.2307_2983885.txt | tail -n -2)"
The output I get drops the last empty line. Why is that?
newlines printf
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago
add a comment |
Starting from:
$ cat bib/10.2307_2983885.txt
@article{10.2307/2983885,
ISSN = {00359246},
URL = {http://www.jstor.org/stable/2983885},
abstract = {The essence of many statistical problems, including most standard techniques, is to test whether or not the unknown parameters of an appropriate statistical model satisfy certain restrictions; and the outcome of such a test dictates whether it is necessary to provide estimates of these parameters which also satisfy the restrictions. In this paper we discuss and illustrate the relative merits, as practical tools for the consulting statistician, of two large-sample techniques of wide applicability to such situations: (i) unrestricted maximum-likelihood estimation with its associated Wald test, (ii) restricted maximum-likelihood estimation with its associated Lagrange-multiplier test. The discussion falls into two main sections corresponding to two methods of specifying restrictions, as constraint equations in the parameters, or as freedom equations expressing the parameters in terms of a second smaller set of parameters. The methods are modified by a simple device to apply to the case where constraints on the parameters are necessary to allow their identification.},
author = {J. Aitchison and S. D. Silvey},
journal = {Journal of the Royal Statistical Society. Series B (Methodological)},
number = {1},
pages = {154--171},
publisher = {[Royal Statistical Society, Wiley]},
title = {Maximum-Likelihood Estimation Procedures and Associated Tests of Significance},
volume = {22},
year = {1960}
}
Notice there is an empty line after the last }. I now try to recombine different parts:
$ printf "%bn" "$(cat bib/10.2307_2983885.txt | head -n1)" "$(cat bib/10.2307_2983885.txt | head -n -2 | tail -n +2)" "$(cat bib/10.2307_2983885.txt | tail -n -2)"
The output I get drops the last empty line. Why is that?
newlines printf
Starting from:
$ cat bib/10.2307_2983885.txt
@article{10.2307/2983885,
ISSN = {00359246},
URL = {http://www.jstor.org/stable/2983885},
abstract = {The essence of many statistical problems, including most standard techniques, is to test whether or not the unknown parameters of an appropriate statistical model satisfy certain restrictions; and the outcome of such a test dictates whether it is necessary to provide estimates of these parameters which also satisfy the restrictions. In this paper we discuss and illustrate the relative merits, as practical tools for the consulting statistician, of two large-sample techniques of wide applicability to such situations: (i) unrestricted maximum-likelihood estimation with its associated Wald test, (ii) restricted maximum-likelihood estimation with its associated Lagrange-multiplier test. The discussion falls into two main sections corresponding to two methods of specifying restrictions, as constraint equations in the parameters, or as freedom equations expressing the parameters in terms of a second smaller set of parameters. The methods are modified by a simple device to apply to the case where constraints on the parameters are necessary to allow their identification.},
author = {J. Aitchison and S. D. Silvey},
journal = {Journal of the Royal Statistical Society. Series B (Methodological)},
number = {1},
pages = {154--171},
publisher = {[Royal Statistical Society, Wiley]},
title = {Maximum-Likelihood Estimation Procedures and Associated Tests of Significance},
volume = {22},
year = {1960}
}
Notice there is an empty line after the last }. I now try to recombine different parts:
$ printf "%bn" "$(cat bib/10.2307_2983885.txt | head -n1)" "$(cat bib/10.2307_2983885.txt | head -n -2 | tail -n +2)" "$(cat bib/10.2307_2983885.txt | tail -n -2)"
The output I get drops the last empty line. Why is that?
newlines printf
newlines printf
asked 42 mins ago
ErwannErwann
711 silver badge9 bronze badges
711 silver badge9 bronze badges
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago
add a comment |
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f529467%2fhow-printf-handles-empty-lines%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f529467%2fhow-printf-handles-empty-lines%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where has the trailing newline char gone from my command substitution?
– Mark Plotnick
32 mins ago