Split /etc/passwd file using perl script
Split /etc/passwd file using perl script
This tutorial will show you how to split /etc/passwd file using perl script.If you just have look at the passwd file you can see the lines are separated with semicolon “:” and that is being used to split the file here.
#!/usr/bin/perl $filename = '/etc/passwd'; open(FILE, $filename) or die "Could not read from $filename, program halting."; print "USERNAME USERID\n"; print "---------------------------------------\n"; while(<file>) { chomp; @fields = split(':', $_); print "$fields[0] $fields[2]\n"; close FILE;Split /etc/passwd file using perl script,
Incoming search terms:
- how do you split a file in perl script (1)
- perl read /etc/passwd (1)
- perl script to edit passwd pentest (1)
- perl script to parse /etc/passwd (1)
- perl split (1)
- perl split mailbox file (1)
- perl split username from /etc/passwd (1)
- read /etc/passwd file with fields in perl (1)
- script passwd split fields (1)
- perl program using the passwd file (1)
- perl printing users list from passwd file to a file (1)
- perl get full name from passwd file (1)
- how to read from passwd fiel in perl? (1)
- how to split a file in perl (1)
- outputting fields in etc/passwd file using perl (1)
- parse /etc/passwd (1)
- parsing /etc/passwd with perl (1)
- parsing passwd file with a script (1)
- passwd (1)
- passwd -s fields (1)
- to print userid and user name of /etc/passwd file (1)