Re: userid change to upper case
From: Bill Marcum (bmarcum_at_iglou.com.urgent)
Date: 06/17/05
- Previous message: John W. Krahn: "Re: Replace several lines by a line"
- In reply to: nasir: "userid change to upper case"
- Next in thread: Lew Pitcher: "Re: userid change to upper case"
- Reply: Lew Pitcher: "Re: userid change to upper case"
- Reply: nasir: "Re: userid change to upper case"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: John W. Krahn: "Re: Replace several lines by a line"
- In reply to: nasir: "userid change to upper case"
- Next in thread: Lew Pitcher: "Re: userid change to upper case"
- Reply: Lew Pitcher: "Re: userid change to upper case"
- Reply: nasir: "Re: userid change to upper case"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|