- 论坛徽章:
- 0
|
awk 'BEGIN{RS="";FS="\n"} /password = \*/{print $1}'
echo 'g/password = [*]/-1p'|ed -s urfile
awk -vRS="" -vFS="\n" '{if($2==" password = *")print $1}' passwdfile
awk -vRS="" -vFS="\n" '{if($2~/password = \*/)print $1}'
the above works very well in AIX.
The following only works in Linux,
sed -n '/:/{h;n};/*/{x;p}'
sed -n '/password = \*/{g;p};h' file
sed -rn '/^[^ \t]+/{N;/password = \*/P}'
-r, --regexp-extended use extended regular expressions in the script
AIX doesn't have -r option but do have regexp command.
I will figure out how regexp work in the future.
I really appreciate your help. Thanks guys. |
|