XXX
分类: LINUX
2013-03-26 11:56:43
第一个练习,你的输入是按照下列形式的行:
Username:Firstname:Lastname:Telephone number
写一个把这样的行转换成一个如下LDAP记录格式的 awk 脚本:
dn: uid=Username, dc=example, dc=com
cn: Firstname Lastname
sn: Lastname
telephoneNumber: Telephone number
建立并检查一个包含一系列测试记录的文件。
完成awk脚本文件如下:
BEGIN { FS=":" } |
测试:
[armlinux@lqm practice]$ awk -f testawk1 test |
awk脚本还可以更改为:
[armlinux@lqm practice]$ cat testawk |
习题二(2007-02-08)
以下列格式为准从 Tab分割列表中建立XML风格输出:
Meaning very long line with a lot of description
meaning another long line
othermeaning more longline
testmeaning loooline, but i mean really ooong.
输出像这样:
Meaning
very long line
meaning
long line
more longline
loooline, but i mean really ooong.
[armlinux@lqm practice]$ cat xml |