Replace field with awk/sed
[ Please don't top post ]
awk -F: -v OFS=: '!/^root:/ {$2 = "TEST"}{ print }' /etc/passwd --
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|