在/etc/password用户名前面加hello,ID前加is

方法2:
#!/bin/sh
 #set -x
 file=/etc/passwd
 while read LINE
 #for i in `cat $file`
 do
        #username=`echo $i|cut -d: -f1`
        username=`echo $LINE|awk -F: '{print $1}'`
        userid=`echo $LINE|cut -d: -f3-4`
        echo "hello $username id is $userid"
 done<$file
 a=`wc -l "$file"`
 echo "$a line"
 #cut -d: -f1|wc -l
 #grep -n "" $file|tail -1|cut -d: -f1
 #grep -c "" /etc/passwd $file|tail -1
 #sed -c "=" $fil|tail -1
 #sed -n -c "=" $file|tail -1
 #awk 'END{print NR}' $file

 #set +x

 

posted @ 2016-12-01 16:14  feng_kui  阅读(623)  评论(0编辑  收藏  举报