Re: userid change to upper case

From: Bill Marcum (bmarcum_at_iglou.com.urgent)
Date: 06/17/05

  • Next message: Bill Marcum: "Re: Replace several lines by a line"
    Date: Thu, 16 Jun 2005 18:07:02 -0400
    
    

    On 16 Jun 2005 13:56:46 -0700, nasir
      <nasir.kamal@gmail.com> wrote:
    > how can I change the userid of a user in /etc/passwd file matching a
    > specific pattern to upper case? The pattern to be looked for is e.g.
    > "uy???abc"
    >
    > I would prefer sed.
    >
    But awk would be easier:
    awk -F: -v OFS=: '$1~/uy...abc/{$1=toupper($1)}{print}' /etc/passwd \
    >passwd.tmp
    mv passwd.tmp /etc/passwd

    sed has the 'y/abcdef/ABCDEF/' command which can convert lower to upper
    case and vice versa, but it works on a whole line at a time.

    You may also need to change the usernames in /etc/shadow, and in some
    versions of *ix the login program will not accept an uppercase username.
    In fact, I'm not sure if any do allow it.

    -- 
    I cannot believe that God plays dice with the cosmos.
    		-- Albert Einstein, on the randomness of quantum mechanics
    

  • Next message: Bill Marcum: "Re: Replace several lines by a line"

    Relevant Pages

    • Re: Shell Script Question ( Case conversion)
      ... >Files can be upper or Lower Case. ... You could convert the string $abc into a pattern, ... One way of doing the conversion is to use some 'awk' code since ... conversion functions toupper() and tolower; ...
      (comp.unix.shell)
    • Re: Volte-face by GFS
      ... Well I wasn't talking about blocking, my analysis was talking about a cold ... plunge and a transition to a longwave upper trough near the meridian or just ... "topplers" occur in a progressive pattern with a two day ... likely to experience in the UK; not weather from the continent which ...
      (uk.sci.weather)
    • Re: userid change to upper case
      ... The pattern to be looked for is e.g. ... > versions of *ix the login program will not accept an uppercase username. ... Registered Linux User #112576 ...
      (comp.unix.shell)
    • Re: Design help please
      ... I am now ONLY able to see it run from upper right to lower left. ... wife, when she sees it, thinks that the pattern of the hollow blocks ... flow from top left to bottom right. ... Whichever you choose to pronounce. ...
      (rec.crafts.textiles.quilting)
    • Re: Still blocked
      ... particular pattern, due to the configuration of the jetstream over a ... Essentially it is caused when an upper ridge exists just to the east ... upper air configuration, ...
      (uk.sci.weather)