Awk to get all my regular users in shadowConvey some message to all usersHow can I process multi-line records with awk in a bash script?return value from awkUpstart - unable to read /etc/shadow unless sudoBash: Regular Expressions in substitutionSet expire date for usersGet one element of path string using bashSeparating Commands in a Script File?Substitute cut command inside AWK scriptMake variables show a column with awk

How can I perform a deterministic physics simulation?

Is an "are" omitted in this sentence

Write The Shortest Program to Calculate Height of a Binary Tree

What could prevent players from leaving an island?

A Haskell implementation of Conway's Game of Life, viewable on the console, no external libs

Why is it to say 'paucis post diebus'?

conditional probability of dependent random variables

Based on what criteria do you add/not add icons to labels within a toolbar?

What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?

Meaning of ギャップ in the following sentence

What is the difference between "un plan" and "une carte" (in the context of map)?

Is there a booking app or site that lets you specify your gender for shared dormitories?

State of a Robot

Using Forstner bits instead of hole saws

How do people drown while wearing a life jacket?

Why is Heisenberg shown dead in Negro y Azul?

What is the difference between get_permalink vs get_the_permalink?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

Difference between "jail" and "prison" in German

Is there a way to say "double + any number" in German?

Is there a command-line tool for converting html files to pdf?

What does "autolyco-sentimental" mean?

Is there a difference between `board[x, y]` and `board[x][y]` in Python?

Why does capacitance not depend on the material of the plates?



Awk to get all my regular users in shadow


Convey some message to all usersHow can I process multi-line records with awk in a bash script?return value from awkUpstart - unable to read /etc/shadow unless sudoBash: Regular Expressions in substitutionSet expire date for usersGet one element of path string using bashSeparating Commands in a Script File?Substitute cut command inside AWK scriptMake variables show a column with awk






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








3















I have a script.



I want to get all my regular users from /etc/shadow e.g all users which second term in shadow file begins with $ or !$.



My pattern is



sudo getent shadow | awk -F: '$2 ~ /^$/ || /^!$/ print $1'


It doesn't work for now.










share|improve this question


























  • does it have to be awk? :-)

    – Rinzwind
    8 hours ago

















3















I have a script.



I want to get all my regular users from /etc/shadow e.g all users which second term in shadow file begins with $ or !$.



My pattern is



sudo getent shadow | awk -F: '$2 ~ /^$/ || /^!$/ print $1'


It doesn't work for now.










share|improve this question


























  • does it have to be awk? :-)

    – Rinzwind
    8 hours ago













3












3








3








I have a script.



I want to get all my regular users from /etc/shadow e.g all users which second term in shadow file begins with $ or !$.



My pattern is



sudo getent shadow | awk -F: '$2 ~ /^$/ || /^!$/ print $1'


It doesn't work for now.










share|improve this question
















I have a script.



I want to get all my regular users from /etc/shadow e.g all users which second term in shadow file begins with $ or !$.



My pattern is



sudo getent shadow | awk -F: '$2 ~ /^$/ || /^!$/ print $1'


It doesn't work for now.







bash scripts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago









Eliah Kagan

87.7k22 gold badges243 silver badges386 bronze badges




87.7k22 gold badges243 silver badges386 bronze badges










asked 8 hours ago









danasodanaso

575 bronze badges




575 bronze badges















  • does it have to be awk? :-)

    – Rinzwind
    8 hours ago

















  • does it have to be awk? :-)

    – Rinzwind
    8 hours ago
















does it have to be awk? :-)

– Rinzwind
8 hours ago





does it have to be awk? :-)

– Rinzwind
8 hours ago










2 Answers
2






active

oldest

votes


















5














You need to escape the $, as it is a special char for "End of Line" much like ^ is "Beginning of Line".



sudo getent shadow | awk -F: '$2 ~ /^$/ || $2 ~ /^!$/ print $1'





share|improve this answer



























  • +1 good catch :)

    – Rinzwind
    8 hours ago











  • Thanks, it works. I just need to not include root user

    – danaso
    8 hours ago


















2














All users with a password set can be listed like this:



getent shadow | egrep '^[^:]*:[*!]:' -v | cut -f1 -d:





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/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%2faskubuntu.com%2fquestions%2f1163551%2fawk-to-get-all-my-regular-users-in-shadow%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









    5














    You need to escape the $, as it is a special char for "End of Line" much like ^ is "Beginning of Line".



    sudo getent shadow | awk -F: '$2 ~ /^$/ || $2 ~ /^!$/ print $1'





    share|improve this answer



























    • +1 good catch :)

      – Rinzwind
      8 hours ago











    • Thanks, it works. I just need to not include root user

      – danaso
      8 hours ago















    5














    You need to escape the $, as it is a special char for "End of Line" much like ^ is "Beginning of Line".



    sudo getent shadow | awk -F: '$2 ~ /^$/ || $2 ~ /^!$/ print $1'





    share|improve this answer



























    • +1 good catch :)

      – Rinzwind
      8 hours ago











    • Thanks, it works. I just need to not include root user

      – danaso
      8 hours ago













    5












    5








    5







    You need to escape the $, as it is a special char for "End of Line" much like ^ is "Beginning of Line".



    sudo getent shadow | awk -F: '$2 ~ /^$/ || $2 ~ /^!$/ print $1'





    share|improve this answer















    You need to escape the $, as it is a special char for "End of Line" much like ^ is "Beginning of Line".



    sudo getent shadow | awk -F: '$2 ~ /^$/ || $2 ~ /^!$/ print $1'






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 8 hours ago

























    answered 8 hours ago









    pLumopLumo

    10.4k21 silver badges48 bronze badges




    10.4k21 silver badges48 bronze badges















    • +1 good catch :)

      – Rinzwind
      8 hours ago











    • Thanks, it works. I just need to not include root user

      – danaso
      8 hours ago

















    • +1 good catch :)

      – Rinzwind
      8 hours ago











    • Thanks, it works. I just need to not include root user

      – danaso
      8 hours ago
















    +1 good catch :)

    – Rinzwind
    8 hours ago





    +1 good catch :)

    – Rinzwind
    8 hours ago













    Thanks, it works. I just need to not include root user

    – danaso
    8 hours ago





    Thanks, it works. I just need to not include root user

    – danaso
    8 hours ago













    2














    All users with a password set can be listed like this:



    getent shadow | egrep '^[^:]*:[*!]:' -v | cut -f1 -d:





    share|improve this answer





























      2














      All users with a password set can be listed like this:



      getent shadow | egrep '^[^:]*:[*!]:' -v | cut -f1 -d:





      share|improve this answer



























        2












        2








        2







        All users with a password set can be listed like this:



        getent shadow | egrep '^[^:]*:[*!]:' -v | cut -f1 -d:





        share|improve this answer













        All users with a password set can be listed like this:



        getent shadow | egrep '^[^:]*:[*!]:' -v | cut -f1 -d:






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 8 hours ago









        RinzwindRinzwind

        220k29 gold badges425 silver badges567 bronze badges




        220k29 gold badges425 silver badges567 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%2f1163551%2fawk-to-get-all-my-regular-users-in-shadow%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

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480