grep的值和重新排列文件 [英] grep values and re-arranging the file
本文介绍了grep的值和重新排列文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我有一个文件名的test.txt
hi i have a file name test.txt
(standard input):8: <property name="ProcedureName" value="abc"/>
(standard input):7: <property name="PackageName" value="123abc"/>
(standard input):8: <property name="ProcedureName" value="bac"/>
(standard input):7: <property name="PackageName" value="bac123"/>
(standard input):8: <property name="ProcedureName" value="cde"/>
(standard input):7: <property name="PackageName" value="cd123"/>
(standard input):8: <property name="ProcedureName" value="b4u"/>
(standard input):7: <property name="PackageName" value="b4u234"/>
我必须从这个文件中的follwing格式用grep包名和procdeurename只值:成O / P文件
i have to grep only values of packagename and procdeurename from this file in the follwing format: into an o/p file
abc/123abc
bac/bac123
cde/cd123
b4u/b4u234
试图削减和awk,但不可能得到
tried cut and awk but couldnt get that
推荐答案
试试这个 AWK
:
awk -F'"' 'NR%2{p1=$4;next} {print p1 "/" $4}'
测试:
$ awk -F'"' 'NR%2{p1=$4;next} {print p1 "/" $4}' file
abc/123abc
bac/bac123
cde/cd123
b4u/b4u234
这篇关于grep的值和重新排列文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文