|
发表于 2006-3-1 13:37:53
|
显示全部楼层
习题1
There are two files. First one is like this:
- ifconfig
- shutdown
- iptables
- fdisk
复制代码
and the second is like:
- The ifconfig command is used to configure
- the kernel-resident network interfaces.
- It is used at boot time to set up interfaces as necessary.
- After that,
- it is usually only needed when debugging or when system tuning is needed.
- shutdown command brings the system down in a secure way.
- All logged-in users are notified that the system is going down, and login(1) is blocked. It
- is possible to shut the system down immediately or after a specified delay.
- Iptables is used
- to set up, maintain, and inspect the tables of IP packet filter rules in the
- Linux kernel. Several different tables may be
- defined.
- Each table contains a number of built-in
- chains and may also contain user-defined chains.
- Hard disks can be divided into one or more logical disks called partitions.
- This division is described
- in the partition table found in sector 0
- of the disk.
复制代码
文件结构特征:
1.文件1有很多命令,每个命令一行,中间没有任何空格。
2.文件2是相对文件1各个命令的解释,但由于转换的时候丢失了格式,现在是乱七八糟。各个命令的解释都被切成了几行,中间有不等的空格分开。文件的最后也有很多空行。(由于网页的原因,paste上来的最后的空行好象都被切掉了。请自己在最后加些空行)。
要求:用sed (如果你sed作出来了想用awk试试,也行。但要求是用sed)将这两个文件合成一个文件,同时这个文件的格式必须是这样的:
1. 文件1中的命令仍占一行,以:结尾。
2. 文件2中的解释直接接到各个命令之下,没有空行,同时所有的切开的地方全部都要合成一行。
3. 各个命令和解释之间有1行空格分开。
4. 文件末尾没有空格。
- ifconfig:
- The ifconfig command is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
- shutdown:
- shutdown command brings the system down in a secure way. All logged-in users are notified that the system is going down, and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay.
- iptables:
- Iptables is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user-defined chains.
- fdisk:
- Hard disks can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk.
复制代码 |
|