【发布时间】:2017-09-09 08:22:40
【问题描述】:
我在 unix txt 文件中有以下数据集:
/this/is/a/directory_name/which/i/want:listen= tcp://someurl
/this/is/a/another_directory_name/which/i/want:listen= tcp://someotherurl
基本上预期的输出是:
directory_name <whitespace> tcp://someurl
another_directory_name <whitespace> tcp://someotherurl
以下是我正在尝试但只获取 url 或目录名的命令
cat the_file.txt|awk -F '/' '{print $5}'
cat the_file.txt|awk -F '=' '{print $2}'
有没有办法同时实现上述两个命令并在同一行中获得输出? 非常感谢
【问题讨论】:
标签: bash shell unix awk scripting