我想使用shell脚本将多行插入到文件中.让我们考虑一下我的输入文件内容是: input.txt:
abcd
accd
cdef
line
web
Run Code Online (Sandbox Code Playgroud)
现在我必须在input.txt文件中的'cdef'行后插入四行.插入我的文件后应该改变如下:
abcd
accd
cdef
line1
line2
line3
line4
line
web
Run Code Online (Sandbox Code Playgroud)
我应该使用shell脚本进行上面的插入.谁能帮我?
任何人都可以告诉zmq.sockets的类型是什么?
在什么情况下可以使用这些插座?
我需要的主要区别是zmq.DEALER,并zmq.ROUTER在Python zeroMQ?
哪种类型的插座可以使用这些插座?
我正在研究一个bash shell脚本,它通过将其父文件夹排除到所有目录并且还排除指定的文件夹来为多个文件夹创建tar文件.
目录结构是:
$ ls dir1
dir11 testdir
$ ls dir2
dir12 testdir2
$ ls dir3
dir13 testdir3
$ tar -cvf file1.tar dir1 dir2 dir3 --exclude="test*"
Run Code Online (Sandbox Code Playgroud)
以上工作正常.
但我不想在tar中使用dir1,dir2和dir3文件夹.我只需要在文件和目录中.
所以我的最终焦油应该包含如下
$ tar -tvf file1.tar
dir11 dir12 dir13
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题.提前致谢
如何在python中删除字符串中的特定空格.
我的输入字符串是:,
str1 = """vendor_id\t: GenuineIntel
cpu family\t: 6
model\t\t: 58
model name\t: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping\t: 9
cpu MHz\t\t: 2485.659
cache size\t: 6144 KB
fpu\t\t: yes
fpu_exception\t: yes
cpuid level\t: 5
wp\t\t: yes"""
Run Code Online (Sandbox Code Playgroud)
我要求的输出是:
>>>print str1
vendor_id: GenuineIntel
cpu family: 6
model: 58
model name: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
stepping: 9
cpu MHz: 2485.659
cache size: 6144 KB
fpu: yes
fpu_exception: yes
cpuid level: 5
wp: yes
Run Code Online (Sandbox Code Playgroud)