|
沙发

楼主 |
发表于 2012-1-18 18:00:07
|
只看该作者
几种常用地址格式
测试文本:$cat temp.txt
1. Linux - Sysadmin, Scripting etc.
2. Databases - Oracle, mySQL etc.
3. Hardware
4. Security (Firewall, Network, Online Security etc)
5. Storage
6. Cool gadgets and websites
7. Productivity (Too many technologies to explore, not much time available)
8. Website Design
9. Software Development
10.Windows- Sysadmin, reboot etc. 格式一:Number (数字地址)
该格式仅匹配“第x行”输出:# sed -n '8'p temp.txt
8. Website Design 格式二:number-1 ~ number-2
输出 number-1 以及每隔 number-2 的行:# sed -n '3~2'p temp.txt
3. Hardware
5. Storage
7. Productivity (Too many technologies to explore, not much time available)
9. Software Development 格式三:start,end
输出 start 到 end 之间的行:# sed -n '3,8'p temp.txt
3. Hardware
4. Security (Firewall, Network, Online Security etc)
5. Storage
6. Cool gadgets and websites
7. Productivity (Too many technologies to explore, not much time available)
8. Website Design 格式四:'$'最后一行# sed -n '$'p temp.txt
10.Windows- Sysadmin, reboot etc. 格式五:Number,$
打印从 Number 到最后一行:# sed -n '3,$'p temp.txt
3. Hardware
4. Security (Firewall, Network, Online Security etc)
5. Storage
6. Cool gadgets and websites
7. Productivity (Too many technologies to explore, not much time available)
8. Website Design
9. Software Development
10.Windows- Sysadmin, reboot etc. |
|