- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- gawk command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-11-2005 07:51 AM
тАО08-11-2005 07:51 AM
gawk command
thanks and points will be assigned.
Currently /etc/shadow looks like this...
odaos:$1$0rP21yM.$.NsFDQTtnnu7GE5qs84D/0:12492:0:99999:7:::
I want the 2nd field to be like such "*".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-11-2005 08:58 AM
тАО08-11-2005 08:58 AM
Re: gawk command
If the first, then don't use awk, as it will require a temporary file and a move.
If you want to lock an account, then use the 'passwd -l
If it's just for displaying on the screen, then use something like:
awk 'BEGIN {FS=":";OFS=FS}{$2 = "*";print}' /etc/shadow
FS = field separator, OFS = output field separator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-11-2005 05:58 PM
тАО08-11-2005 05:58 PM
Re: gawk command
perl -ni -e '@a=split /:/;$a[1]="*";$,=":";print @a;' /etc/shadow
Note: It will automatically change /etc/shadow file also. So try to backup /etc/shadow file as /etc/shadow.org
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 02:37 AM
тАО08-12-2005 02:37 AM
Re: gawk command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 03:01 AM
тАО08-12-2005 03:01 AM
Re: gawk command
Anyway, try this:
awk -F ":" -v OFS=":" '$2="*" { print $0 }' /etc/shadow