Parse `df` output for `/dev/disk/by-uuid/xxx`wait for dd command to fully write to the diskRedirecting output to std output or /dev/null depending on optional parameterParse file for recursive patternTroubles piping echo output to xargs script for mv commandNo logging output for cron jobOutput log for bashParse xrandr output to get available resolutionscript for output which having same name as directorySynchronized combination of for loops' outputParse multiline output with bash

If a tournament advertises G/30, can either player demand G/25 d5?

What happens to extra attacks after you kill your declared target

Why do the new Star Trek series have so few episodes in each season?

Would the professor leave the classroom if only 1 student uses their cellphone during class?

How to deal with non-stop callers in the service desk

Why does Bane's stock exchange robbery actually work to bankrupt Bruce Wayne?

NFL football incentives

What techniques can I use to seduce a PC without arousing suspicion of ulterior motives?

Define a command differently in inline vs display mode

How could a sequence of random dates be generated, given year interval?

Ambiguity - Should it be "mindful of committing logical fallacies" or "mindful of not committing logical fallacies"?

What elements would be created in a star composed entirely of gold?

What's a good strategy for offering low on a house?

If a celestial gets corrupted and turns evil, does it get converted to a fiend?

What does “studies need to be taken with more than the usual grain of salt” mean?

Why are the Ukraine related congressional hearings behind closed doors?

How to discourage mundane play?

Why was the "Cave of the Patriarchs" forbidden to Jews?

"Du hast es gut", small talk meaning?

How can Edward Snowden be denied a jury trial?

Why do some switching regulator require tantalum or electrolytic capacitors instead of ceramic?

Why would Climate activists disrupt public transport?

Why do some web servers still provide information on vendor and version in the HTTP response headers

where does black come from in CMYK color mode?



Parse `df` output for `/dev/disk/by-uuid/xxx`


wait for dd command to fully write to the diskRedirecting output to std output or /dev/null depending on optional parameterParse file for recursive patternTroubles piping echo output to xargs script for mv commandNo logging output for cron jobOutput log for bashParse xrandr output to get available resolutionscript for output which having same name as directorySynchronized combination of for loops' outputParse multiline output with bash






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0

















I would like to ask you why this command work



df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g'


But not this one?



df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g'


Something to change or is impossible that work with uuid?



This is my full script



#!/bin/bash
inputa=90
#outputa=$(df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g')
outputa=$(df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g')

if [ "$inputa -lt $outputa" ]
then
find /home/user/Documents/ipcams/ipcam2 -type f -name "*.mp4" -mtime +25 -exec rm ;
(date +"%Y-%m-%d Heure: %H-%M-%S") >> /home/user/ipcam.log
echo Pourcentage $outputa "%" >> /home/user/ipcam.log

else echo rien

fi


Have a great day



Thanks










share|improve this question


































    0

















    I would like to ask you why this command work



    df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g'


    But not this one?



    df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g'


    Something to change or is impossible that work with uuid?



    This is my full script



    #!/bin/bash
    inputa=90
    #outputa=$(df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g')
    outputa=$(df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g')

    if [ "$inputa -lt $outputa" ]
    then
    find /home/user/Documents/ipcams/ipcam2 -type f -name "*.mp4" -mtime +25 -exec rm ;
    (date +"%Y-%m-%d Heure: %H-%M-%S") >> /home/user/ipcam.log
    echo Pourcentage $outputa "%" >> /home/user/ipcam.log

    else echo rien

    fi


    Have a great day



    Thanks










    share|improve this question






























      0












      0








      0








      I would like to ask you why this command work



      df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g'


      But not this one?



      df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g'


      Something to change or is impossible that work with uuid?



      This is my full script



      #!/bin/bash
      inputa=90
      #outputa=$(df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g')
      outputa=$(df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g')

      if [ "$inputa -lt $outputa" ]
      then
      find /home/user/Documents/ipcams/ipcam2 -type f -name "*.mp4" -mtime +25 -exec rm ;
      (date +"%Y-%m-%d Heure: %H-%M-%S") >> /home/user/ipcam.log
      echo Pourcentage $outputa "%" >> /home/user/ipcam.log

      else echo rien

      fi


      Have a great day



      Thanks










      share|improve this question

















      I would like to ask you why this command work



      df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g'


      But not this one?



      df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g'


      Something to change or is impossible that work with uuid?



      This is my full script



      #!/bin/bash
      inputa=90
      #outputa=$(df -P /dev/sda1 | grep /dev/sda1 | awk ' print $5' | sed 's/%//g')
      outputa=$(df -P /dev/disk/by-uuid/0E5E17800E5E1780 | grep /dev/disk/by-uuid/0E5E17800E5E1780 | awk ' print $5' | sed 's/%//g')

      if [ "$inputa -lt $outputa" ]
      then
      find /home/user/Documents/ipcams/ipcam2 -type f -name "*.mp4" -mtime +25 -exec rm ;
      (date +"%Y-%m-%d Heure: %H-%M-%S") >> /home/user/ipcam.log
      echo Pourcentage $outputa "%" >> /home/user/ipcam.log

      else echo rien

      fi


      Have a great day



      Thanks







      command-line bash






      share|improve this question
















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 30 at 13:05







      John

















      asked May 30 at 12:20









      JohnJohn

      861 gold badge1 silver badge6 bronze badges




      861 gold badge1 silver badge6 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          2


















          The problem is that although df shows information about the device specified by the UUID, the first column of its output still refers to it by the /dev/sdXY block device name - so the grep fails to match.



          In fact, there's no need to use grep at all - you can use awk to skip the header line (and even to remove the % sign):



          $ df -P /dev/sda1 | awk 'NR == 2 print substr($5,1,length($5)-1) '
          80

          $ df -P /dev/disk/by-uuid/79b5546e-5b3e-4299-becb-5f0cad06cf5f | awk 'NR == 2 print substr($5,1,length($5)-1) '
          80





          share|improve this answer

































            1


















            /dev/disk/by-uuid/0E5E17800E5E178 is a link to a Device, which may or may not contain a Filesystem. df works only on filesystems, not raw devices. From man df:



            df displays the amount of disk space available on the file system containing each file name argument.





            share|improve this answer



























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "89"
              ;
              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: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f1147406%2fparse-df-output-for-dev-disk-by-uuid-xxx%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









              2


















              The problem is that although df shows information about the device specified by the UUID, the first column of its output still refers to it by the /dev/sdXY block device name - so the grep fails to match.



              In fact, there's no need to use grep at all - you can use awk to skip the header line (and even to remove the % sign):



              $ df -P /dev/sda1 | awk 'NR == 2 print substr($5,1,length($5)-1) '
              80

              $ df -P /dev/disk/by-uuid/79b5546e-5b3e-4299-becb-5f0cad06cf5f | awk 'NR == 2 print substr($5,1,length($5)-1) '
              80





              share|improve this answer






























                2


















                The problem is that although df shows information about the device specified by the UUID, the first column of its output still refers to it by the /dev/sdXY block device name - so the grep fails to match.



                In fact, there's no need to use grep at all - you can use awk to skip the header line (and even to remove the % sign):



                $ df -P /dev/sda1 | awk 'NR == 2 print substr($5,1,length($5)-1) '
                80

                $ df -P /dev/disk/by-uuid/79b5546e-5b3e-4299-becb-5f0cad06cf5f | awk 'NR == 2 print substr($5,1,length($5)-1) '
                80





                share|improve this answer




























                  2














                  2










                  2









                  The problem is that although df shows information about the device specified by the UUID, the first column of its output still refers to it by the /dev/sdXY block device name - so the grep fails to match.



                  In fact, there's no need to use grep at all - you can use awk to skip the header line (and even to remove the % sign):



                  $ df -P /dev/sda1 | awk 'NR == 2 print substr($5,1,length($5)-1) '
                  80

                  $ df -P /dev/disk/by-uuid/79b5546e-5b3e-4299-becb-5f0cad06cf5f | awk 'NR == 2 print substr($5,1,length($5)-1) '
                  80





                  share|improve this answer














                  The problem is that although df shows information about the device specified by the UUID, the first column of its output still refers to it by the /dev/sdXY block device name - so the grep fails to match.



                  In fact, there's no need to use grep at all - you can use awk to skip the header line (and even to remove the % sign):



                  $ df -P /dev/sda1 | awk 'NR == 2 print substr($5,1,length($5)-1) '
                  80

                  $ df -P /dev/disk/by-uuid/79b5546e-5b3e-4299-becb-5f0cad06cf5f | awk 'NR == 2 print substr($5,1,length($5)-1) '
                  80






                  share|improve this answer













                  share|improve this answer




                  share|improve this answer










                  answered May 30 at 12:33









                  steeldriversteeldriver

                  80.6k12 gold badges131 silver badges216 bronze badges




                  80.6k12 gold badges131 silver badges216 bronze badges


























                      1


















                      /dev/disk/by-uuid/0E5E17800E5E178 is a link to a Device, which may or may not contain a Filesystem. df works only on filesystems, not raw devices. From man df:



                      df displays the amount of disk space available on the file system containing each file name argument.





                      share|improve this answer






























                        1


















                        /dev/disk/by-uuid/0E5E17800E5E178 is a link to a Device, which may or may not contain a Filesystem. df works only on filesystems, not raw devices. From man df:



                        df displays the amount of disk space available on the file system containing each file name argument.





                        share|improve this answer




























                          1














                          1










                          1









                          /dev/disk/by-uuid/0E5E17800E5E178 is a link to a Device, which may or may not contain a Filesystem. df works only on filesystems, not raw devices. From man df:



                          df displays the amount of disk space available on the file system containing each file name argument.





                          share|improve this answer














                          /dev/disk/by-uuid/0E5E17800E5E178 is a link to a Device, which may or may not contain a Filesystem. df works only on filesystems, not raw devices. From man df:



                          df displays the amount of disk space available on the file system containing each file name argument.






                          share|improve this answer













                          share|improve this answer




                          share|improve this answer










                          answered May 30 at 12:34









                          waltinatorwaltinator

                          25.1k7 gold badges43 silver badges74 bronze badges




                          25.1k7 gold badges43 silver badges74 bronze badges































                              draft saved

                              draft discarded















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • 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%2faskubuntu.com%2fquestions%2f1147406%2fparse-df-output-for-dev-disk-by-uuid-xxx%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

                              Tamil (spriik) Luke uk diar | Nawigatjuun

                              Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                              Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?