设为首页
收藏本站
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
平台
Portal
论坛
BBS
文库
项目
群组
Group
我的博客
Space
搜索
搜索
热搜:
shell
linux
mysql
本版
用户
LinuxSir.cn,穿越时空的Linuxsir!
»
论坛
›
Linux 综合讨论区 —— LinuxSir.cn
›
shell进阶应用、shell编程
›
关于文本文件的块的提取,有什么好办法? ...
返回列表
查看:
665
|
回复:
2
关于文本文件的块的提取,有什么好办法?
[复制链接]
leeshasr
leeshasr
当前离线
积分
475
IP卡
狗仔卡
发表于 2006-10-23 14:03:05
|
显示全部楼层
|
阅读模式
比如:
debian:/home/lee# ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:61:A1:E8:6C
inet addr:192.168.1.33 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::204:61ff:fea1:e86c/64 Scope
ink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22295 errors:0 dropped:0 overruns:0 frame:0
TX packets:20109 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20967132 (19.9 MiB) TX bytes:2801453 (2.6 MiB)
Interrupt:169 Base address:0xd800
lo Link encap
ocal Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:680 (680.0 b) TX bytes:680 (680.0 b)
ppp0 Link encap
oint-to-Point Protocol
inet addr:222.211.161.160 P-t-P:222.211.160.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:20236 errors:0 dropped:0 overruns:0 frame:0
TX packets:19579 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:20398006 (19.4 MiB) TX bytes:2351499 (2.2 MiB)
有什么方法 定位 段落 "块"?
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
显身卡
luke_guo
luke_guo
当前离线
积分
121
IP卡
狗仔卡
发表于 2006-10-23 15:53:10
|
显示全部楼层
你只要提取出两个空行之间的内容再配上你所需要的块的开头字符不就可以了?
回复
支持
反对
使用道具
举报
显身卡
huan
huan
当前离线
积分
462
IP卡
狗仔卡
发表于 2006-10-24 23:12:57
|
显示全部楼层
[0 No.1991 huan@huan ~]$ sudo ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0D:61:90:56:E8
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20d:61ff:fe90:56e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7507 errors:0 dropped:0 overruns:0 frame:0
TX packets:7474 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6660256 (6.3 MiB) TX bytes:1218331 (1.1 MiB)
Interrupt:193 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:800 (800.0 b) TX bytes:800 (800.0 b)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[0 No.1992 huan@huan ~]$ sudo ifconfig -a | perl -0000 -nle '{ print ++$i }'
1
2
3
复制代码
perl 认为这是三段
回复
支持
反对
使用道具
举报
显身卡
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
浏览过的版块
Linux 基础讨论区(新手速成)
Mandriva Linux
Linux 输入开发与研究
Redhat/Fedora/CentOS Linux
Debian Linux
Gentoo Linux
Ubuntu Linux 专题讨论
LFS(LinuxfromScratch)
Archlinux讨论区
Copyright © 2002-2023
LinuxSir.cn
(http://www.linuxsir.cn/) 版权所有 All Rights Reserved.
Powered by
RedflagLinux!
技术支持:
中科红旗
|
京ICP备19024520号
快速回复
返回顶部
返回列表