Printing the column names using the output of “df -h” (macOS)2019 Community Moderator ElectionHow can I use awk to (sometimes) remove the first character of a column?Number of comma-separated fields in a text filePrinting selective fields following 1st column instructionsUsing df and trying to awk a specific columnRemove the multiple comma's from specific column of tab delimited fileand print the words on new lineReplace first column of file by command outputAWK Compare Column 1 from Two Files Print append column to third in outputmacOS: possible that du can report the wrong size for disk usage?How to find lines with different values in 5th column which share the same 2nd column?AWK printing columns based on column number and pattern match condition
Turning a hard to access nut?
Print last inputted byte
pipe commands inside find -exec?
Have any astronauts/cosmonauts died in space?
Norwegian Refugee travel document
How to read string as hex number in bash?
Would storms on an ocean world harm the marine life?
Print a physical multiplication table
Extraneous elements in "Europe countries" list
How can a new country break out from a developed country without war?
Why didn't Héctor fade away after this character died in the movie Coco?
Is xar preinstalled on macOS?
label a part of commutative diagram
How to find the largest number(s) in a list of elements?
Why are there no stars visible in cislunar space?
Would mining huge amounts of resources on the Moon change its orbit?
Have the tides ever turned twice on any open problem?
Why is this tree refusing to shed its dead leaves?
If I cast enlarge/reduce on an arrow, what weapon could it count as?
Error in master's thesis, I do not know what to do
What is the reasoning behind standardization (dividing by standard deviation)?
How can I create URL shortcuts/redirects for task/diff IDs in Phabricator?
Should I be concerned about student access to a test bank?
Does fire aspect on a sword, destroy mob drops?
Printing the column names using the output of “df -h” (macOS)
2019 Community Moderator ElectionHow can I use awk to (sometimes) remove the first character of a column?Number of comma-separated fields in a text filePrinting selective fields following 1st column instructionsUsing df and trying to awk a specific columnRemove the multiple comma's from specific column of tab delimited fileand print the words on new lineReplace first column of file by command outputAWK Compare Column 1 from Two Files Print append column to third in outputmacOS: possible that du can report the wrong size for disk usage?How to find lines with different values in 5th column which share the same 2nd column?AWK printing columns based on column number and pattern match condition
I am trying to:
Print the output of the command "df -h" (in macOS),but only with /dev/disk* as ouptut. I used the following command:
df -h|awk -F"t" '//[d-v]3/[a-z]4[0-9]1[s-t]1[0-9]1/print'|uniq -c

The original output of command df-h contains the column headers such as "FileSystem ,size,used etc."I trying to achieve the same via the code.
shell-script awk disk-usage
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am trying to:
Print the output of the command "df -h" (in macOS),but only with /dev/disk* as ouptut. I used the following command:
df -h|awk -F"t" '//[d-v]3/[a-z]4[0-9]1[s-t]1[0-9]1/print'|uniq -c

The original output of command df-h contains the column headers such as "FileSystem ,size,used etc."I trying to achieve the same via the code.
shell-script awk disk-usage
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am trying to:
Print the output of the command "df -h" (in macOS),but only with /dev/disk* as ouptut. I used the following command:
df -h|awk -F"t" '//[d-v]3/[a-z]4[0-9]1[s-t]1[0-9]1/print'|uniq -c

The original output of command df-h contains the column headers such as "FileSystem ,size,used etc."I trying to achieve the same via the code.
shell-script awk disk-usage
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am trying to:
Print the output of the command "df -h" (in macOS),but only with /dev/disk* as ouptut. I used the following command:
df -h|awk -F"t" '//[d-v]3/[a-z]4[0-9]1[s-t]1[0-9]1/print'|uniq -c

The original output of command df-h contains the column headers such as "FileSystem ,size,used etc."I trying to achieve the same via the code.
shell-script awk disk-usage
shell-script awk disk-usage
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 10 hours ago
Jeff Schaller
43.5k1161140
43.5k1161140
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 10 hours ago
swasti bhushan debswasti bhushan deb
61
61
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
swasti bhushan deb is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
you almost manage it
awk 'NR==1 print ; /your code/ print ;
where
NR==1 print ;will instruct awk to print first line (Number of Record == 1 )
Thanks guys..It works
– swasti bhushan deb
10 hours ago
add a comment |
df -h|awk 'NR==1 || //dev/disk/ print'|uniq -c
This prints the first record (denoted by NR, which is the header) and then any lines matching /dev/disk. The || means "or".
add a comment |
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
);
);
swasti bhushan deb is a new contributor. Be nice, and check out our Code of Conduct.
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%2f506973%2fprinting-the-column-names-using-the-output-of-df-h-macos%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
you almost manage it
awk 'NR==1 print ; /your code/ print ;
where
NR==1 print ;will instruct awk to print first line (Number of Record == 1 )
Thanks guys..It works
– swasti bhushan deb
10 hours ago
add a comment |
you almost manage it
awk 'NR==1 print ; /your code/ print ;
where
NR==1 print ;will instruct awk to print first line (Number of Record == 1 )
Thanks guys..It works
– swasti bhushan deb
10 hours ago
add a comment |
you almost manage it
awk 'NR==1 print ; /your code/ print ;
where
NR==1 print ;will instruct awk to print first line (Number of Record == 1 )
you almost manage it
awk 'NR==1 print ; /your code/ print ;
where
NR==1 print ;will instruct awk to print first line (Number of Record == 1 )
answered 10 hours ago
ArchemarArchemar
20.2k93973
20.2k93973
Thanks guys..It works
– swasti bhushan deb
10 hours ago
add a comment |
Thanks guys..It works
– swasti bhushan deb
10 hours ago
Thanks guys..It works
– swasti bhushan deb
10 hours ago
Thanks guys..It works
– swasti bhushan deb
10 hours ago
add a comment |
df -h|awk 'NR==1 || //dev/disk/ print'|uniq -c
This prints the first record (denoted by NR, which is the header) and then any lines matching /dev/disk. The || means "or".
add a comment |
df -h|awk 'NR==1 || //dev/disk/ print'|uniq -c
This prints the first record (denoted by NR, which is the header) and then any lines matching /dev/disk. The || means "or".
add a comment |
df -h|awk 'NR==1 || //dev/disk/ print'|uniq -c
This prints the first record (denoted by NR, which is the header) and then any lines matching /dev/disk. The || means "or".
df -h|awk 'NR==1 || //dev/disk/ print'|uniq -c
This prints the first record (denoted by NR, which is the header) and then any lines matching /dev/disk. The || means "or".
edited 10 hours ago
answered 10 hours ago
JRFergusonJRFerguson
10.3k32432
10.3k32432
add a comment |
add a comment |
swasti bhushan deb is a new contributor. Be nice, and check out our Code of Conduct.
swasti bhushan deb is a new contributor. Be nice, and check out our Code of Conduct.
swasti bhushan deb is a new contributor. Be nice, and check out our Code of Conduct.
swasti bhushan deb is a new contributor. Be nice, and check out our Code of Conduct.
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%2f506973%2fprinting-the-column-names-using-the-output-of-df-h-macos%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