I have data that looks like this:
test AA=bddddbs
result=1
cell AA=bnnndb5
result=2
cell1 BB=bnrrndb
result=3
Please help. Find AA=string
.
test AA=bddddbs;result=1
cell AA=bnnndb5;result=2
I am use below command and result fail.
nawk '/AA=/{val=$1;next} {print val,$1}' infile
Using awk
you can do this:
awk -v OFS=';' '/AA=/{rec=$0; getline; print rec, $0}' file
test AA=bddddbs;result=1
cell AA=bnnndb5;result=2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.