如何提取模式在bash的外壳形成一个文本文件 [英] How to extract patterns form a text files in shell bash
本文介绍了如何提取模式在bash的外壳形成一个文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含一个文本文件:
toto.titi.any = VAL1
toto.tata.any = val2的
toto.tete.any = val2的
如何提取蒂蒂
,塔塔
和面对面
从该文件。
应该是有的sthing像
$猫的myfile.txt | SED'......
和输出应该是
蒂蒂
塔塔
面对面
解决方案
你真的需要 SED
?你可以使用剪切
:
切-d。 -f2文件名
I have a text file that contains:
toto.titi.any=val1
toto.tata.any=val2
toto.tete.any=val2
How to extract titi
, tata
and tete
from this file.
Should be some sthing like that
$ cat myfile.txt | sed '......'
and the output should be
titi
tata
tete
解决方案
Do you really need sed
? You could use cut
:
cut -d. -f2 filename
这篇关于如何提取模式在bash的外壳形成一个文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文