string - AWK How to extract substrings from from a variables position and different separator?
问题描述
My input is a file with a thouthans of lines like this:
|0401549244492||20210319163253|1080|0||||||{"key":150,"value":"DLO"},{"key":154,"value":"249920"}
|040148992444924||20210319163253|1080|0||||||{"key":150,"value":"DLO"},{"key":154,"value":"446910"}
Positions arent the same.. i need extract strings inside of ""
ex: DLO
and 5492444924
(from keyy 150
and key 155
..) and extract strings between |
.. its hard for me the firts.. i need make a file with these strings but without |
either key word or :
or ""
.. none of these
i need this, with same positions and fill with 0
.
0401549244492002021031916325310800DLO249920
0401489924449242021031916325310800DLO446910
A lot of thanks!
解决方案
I am assuming that the last 2 rows is the expected output? If so, you can try this awk
but I do not fully understand the request.
awk -F"[}|,\":]" '{print $2 $4 $5 $6 $15 $20}'
04015492444922021031916325310800DLO249920
0401489924449242021031916325310800DLO446910
推荐阅读
- mysql - SQL - 按第 1 列分组,按第 2 列排序
- python - 为 dtype 中的浮点数设置显示格式的精度
- windows - Linux到windows远程执行命令
- angular - $injector 没有提供者-在 AngularJs + Angular 8 混合应用程序单元测试用例中
- javascript - 如何从服务器作为对等点的 .getUserMedia()
- azure - 是否有任何可能的方法来更改现有 VSTS 扩展的发布者 ID?
- python-2.7 - pm2 因太多不稳定的重启而崩溃 (16)。停了下来。python中的“错误”
- python - Python/SQLite3 - 搜索功能不适用于结果的多种组合
- python - 为什么变量有时会在 Python 中绑定两个方向?
- html - 用 flex 拉伸图像