当前位置: 技术问答>linux和unix
linux的shell修改文件内容问题?
来源: 互联网 发布时间:2016-12-05
本文导语: ipfile的文件内容如下: 192.168.7.98 192.168.7.99 192.168.7.110 192.168.7.111 192.168.7.112 192.168.7.113 192.168.7.114 192.168.7.115 192.168.7.116 192.168.14.71 192.168.7.130 192.168.7.117 192.168.7.131 192.168.7.118 192.168.7.132 192.168.7.119 192.168.7.133 192.168.14.90 192....
ipfile的文件内容如下:
192.168.7.98
192.168.7.99
192.168.7.110
192.168.7.111
192.168.7.112
192.168.7.113
192.168.7.114
192.168.7.115
192.168.7.116
192.168.14.71
192.168.7.130
192.168.7.117
192.168.7.131
192.168.7.118
192.168.7.132
192.168.7.119
192.168.7.133
192.168.14.90
192.168.7.1
192.168.14.91
192.168.7.150
192.168.7.137
192.168.7.2
192.168.14.110
192.168.14.92
192.168.7.151
192.168.7.138
192.168.7.3
192.168.14.111
192.168.14.93
192.168.7.152
192.168.7.139
192.168.14.112
192.168.14.94
192.168.7.153
192.168.7.5
192.168.14.113
192.168.14.95
192.168.7.154
192.168.7.6
192.168.14.96
192.168.7.7
192.168.14.97
192.168.7.8
192.168.7.9
192.168.7.158
192.168.7.159
192.168.7.21
192.168.7.22
192.168.7.176
192.168.7.23
192.168.7.177
192.168.7.24
192.168.7.178
192.168.7.27
192.168.2.121
192.168.2.122
192.168.7.100
192.168.7.101
192.168.7.102
192.168.7.103
192.168.7.104
192.168.7.105
192.168.7.106
192.168.7.120
192.168.7.121
192.168.7.122
192.168.7.123
192.168.7.124
192.168.7.125
192.168.14.80
192.168.7.126
192.168.7.127
192.168.14.100
192.168.7.128
192.168.14.101
192.168.7.129
192.168.14.102
192.168.14.103
192.168.14.104
192.168.14.105
192.168.7.146
192.168.14.106
192.168.7.160
192.168.7.147
192.168.14.107
192.168.7.161
192.168.7.148
192.168.14.108
192.168.7.162
192.168.7.149
192.168.14.109
192.168.7.163
192.168.7.10
192.168.7.164
192.168.7.11
192.168.7.165
192.168.7.12
192.168.7.166
192.168.7.167
192.168.7.14
192.168.7.168
192.168.7.169
192.168.7.17
192.168.7.18
192.168.7.19
192.168.7.54
192.168.7.57
请问怎么使用shell脚本该使文件,每12个ip显示在一行啊,例如:
第一行
192.168.7.98,192.168.7.99,192.168.7.110,192.168.7.111,192.168.7.112,192.168.7.113,192.168.7.114,192.168.7.115,192.168.7.116
第二行
192.168.14.71,192.168.7.130,192.168.7.117,192.168.7.131,192.168.7.118,192.168.7.132,192.168.7.119,192.168.7.133,192.168.14.90
..........................................
192.168.7.98
192.168.7.99
192.168.7.110
192.168.7.111
192.168.7.112
192.168.7.113
192.168.7.114
192.168.7.115
192.168.7.116
192.168.14.71
192.168.7.130
192.168.7.117
192.168.7.131
192.168.7.118
192.168.7.132
192.168.7.119
192.168.7.133
192.168.14.90
192.168.7.1
192.168.14.91
192.168.7.150
192.168.7.137
192.168.7.2
192.168.14.110
192.168.14.92
192.168.7.151
192.168.7.138
192.168.7.3
192.168.14.111
192.168.14.93
192.168.7.152
192.168.7.139
192.168.14.112
192.168.14.94
192.168.7.153
192.168.7.5
192.168.14.113
192.168.14.95
192.168.7.154
192.168.7.6
192.168.14.96
192.168.7.7
192.168.14.97
192.168.7.8
192.168.7.9
192.168.7.158
192.168.7.159
192.168.7.21
192.168.7.22
192.168.7.176
192.168.7.23
192.168.7.177
192.168.7.24
192.168.7.178
192.168.7.27
192.168.2.121
192.168.2.122
192.168.7.100
192.168.7.101
192.168.7.102
192.168.7.103
192.168.7.104
192.168.7.105
192.168.7.106
192.168.7.120
192.168.7.121
192.168.7.122
192.168.7.123
192.168.7.124
192.168.7.125
192.168.14.80
192.168.7.126
192.168.7.127
192.168.14.100
192.168.7.128
192.168.14.101
192.168.7.129
192.168.14.102
192.168.14.103
192.168.14.104
192.168.14.105
192.168.7.146
192.168.14.106
192.168.7.160
192.168.7.147
192.168.14.107
192.168.7.161
192.168.7.148
192.168.14.108
192.168.7.162
192.168.7.149
192.168.14.109
192.168.7.163
192.168.7.10
192.168.7.164
192.168.7.11
192.168.7.165
192.168.7.12
192.168.7.166
192.168.7.167
192.168.7.14
192.168.7.168
192.168.7.169
192.168.7.17
192.168.7.18
192.168.7.19
192.168.7.54
192.168.7.57
请问怎么使用shell脚本该使文件,每12个ip显示在一行啊,例如:
第一行
192.168.7.98,192.168.7.99,192.168.7.110,192.168.7.111,192.168.7.112,192.168.7.113,192.168.7.114,192.168.7.115,192.168.7.116
第二行
192.168.14.71,192.168.7.130,192.168.7.117,192.168.7.131,192.168.7.118,192.168.7.132,192.168.7.119,192.168.7.133,192.168.14.90
..........................................
|
awk '{if(NR%12==0){print};printf $0","}' ipfile
|
paste -s -d",,,,,,,,,,,n" ipfile
|
不会操作。。。。