Remove trailing whitespace in df commandStrip trailing whitespace from filesTell fs to free space from...

Can dual citizens open crypto exchange accounts where U.S. citizens are prohibited?

Is there a list of all of the cases in the Talmud where תיקו ("Teiku") is said?

Why wasn't ASCII designed with a contiguous alphanumeric character order?

What is the meaning of 'shout over' in a sentence exactly?

Word ending in "-ine" for rat-like

Where can I find my serialized Sitecore items?

Can I take Amul cottage cheese from India to Netherlands?

German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Is it possible to alias a column based on the result of a select+where?

Where to connect the fuse and why?

Why do some PCBs have exposed plated perimeters?

"I am [the / an] owner of a bookstore"?

Installed software from source, how to say yum not to install it from package?

Subset of knight's move in chess.

How do I tell my girlfriend she's been buying me books by the wrong author for the last nine months?

How to track mail undetectably?

How does the 'five minute adventuring day' affect class balance?

Why doesn't SpaceX land boosters in Africa?

How do I keep a running total of data in a column in Excel?

Position representation of spin states and spin operators

Avoiding repetition when using the "snprintf idiom" to write text

Robots in a spaceship

How far can gerrymandering go?

I just started; should I accept a farewell lunch for a coworker I don't know?



Remove trailing whitespace in df command


Strip trailing whitespace from filesTell fs to free space from deleted files NOWdf, du report incorrect disk usageUsing df and trying to awk a specific columnAny way to change the tab size of the diff command's output?Remove specific columns from csv using awkhow to verify at least XG free space on /varUsing cut and sed command at the same time in a scriptWhy won't the strings command stop?df - size doesn't equal used+available













1















I have the following df command:



> df -h --output=used,avail,pcent /
Used Avail Use%
5.9G 12G 34%


Notice how there is a space before Used and 5.9GB



So I did the following:



> df -h --output=used,avail,pcent / | awk '{$1=$1;print}'
Used Avail Use%
5.9G 12G 34%


It does trim it, but now the 34% isn't aligned with the Use%



How can I fix both of these problems? Strip and keep aligned.










share|improve this question



























    1















    I have the following df command:



    > df -h --output=used,avail,pcent /
    Used Avail Use%
    5.9G 12G 34%


    Notice how there is a space before Used and 5.9GB



    So I did the following:



    > df -h --output=used,avail,pcent / | awk '{$1=$1;print}'
    Used Avail Use%
    5.9G 12G 34%


    It does trim it, but now the 34% isn't aligned with the Use%



    How can I fix both of these problems? Strip and keep aligned.










    share|improve this question

























      1












      1








      1








      I have the following df command:



      > df -h --output=used,avail,pcent /
      Used Avail Use%
      5.9G 12G 34%


      Notice how there is a space before Used and 5.9GB



      So I did the following:



      > df -h --output=used,avail,pcent / | awk '{$1=$1;print}'
      Used Avail Use%
      5.9G 12G 34%


      It does trim it, but now the 34% isn't aligned with the Use%



      How can I fix both of these problems? Strip and keep aligned.










      share|improve this question














      I have the following df command:



      > df -h --output=used,avail,pcent /
      Used Avail Use%
      5.9G 12G 34%


      Notice how there is a space before Used and 5.9GB



      So I did the following:



      > df -h --output=used,avail,pcent / | awk '{$1=$1;print}'
      Used Avail Use%
      5.9G 12G 34%


      It does trim it, but now the 34% isn't aligned with the Use%



      How can I fix both of these problems? Strip and keep aligned.







      shell-script disk-usage string whitespace






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 45 mins ago









      K Split XK Split X

      3782 gold badges4 silver badges19 bronze badges




      3782 gold badges4 silver badges19 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          What about this:



          df -h --output=used,avail,pcent / | awk '{$1=$1;print}' | sed 's/ /t'/g


          Replace spaces for tabs.






          share|improve this answer


























            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
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f527591%2fremove-trailing-whitespace-in-df-command%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            What about this:



            df -h --output=used,avail,pcent / | awk '{$1=$1;print}' | sed 's/ /t'/g


            Replace spaces for tabs.






            share|improve this answer




























              0














              What about this:



              df -h --output=used,avail,pcent / | awk '{$1=$1;print}' | sed 's/ /t'/g


              Replace spaces for tabs.






              share|improve this answer


























                0












                0








                0







                What about this:



                df -h --output=used,avail,pcent / | awk '{$1=$1;print}' | sed 's/ /t'/g


                Replace spaces for tabs.






                share|improve this answer













                What about this:



                df -h --output=used,avail,pcent / | awk '{$1=$1;print}' | sed 's/ /t'/g


                Replace spaces for tabs.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 33 mins ago









                guillermo chamorroguillermo chamorro

                19310 bronze badges




                19310 bronze badges






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f527591%2fremove-trailing-whitespace-in-df-command%23new-answer', 'question_page');
                    }
                    );

                    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







                    Popular posts from this blog

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...