bash - syntax error near unexpected token `(' : output awk result as variable
问题描述
I want to process a tab-limited file text using awk and set the output as variable in unix.
I wanted to i) select lines that have unique combinations of values in the 1st and 3rd column; ii) sort by increasing numeric value at the first column; iii) extract the first column; etc.. So I used the following script:
locus_overmerged=$(awk -F"\t" '!seen[$1, $3]++' <(gzip -dc $id) | sort -n -k1,1 | cut -f1 | uniq -dc | awk '{print $2}')
If I run it by hand in the terminal, it works. However, when I input this command in a script, I obtain the following error:
syntax error near unexpected token `('
` awk -F"\t" '!seen[$1, $3]++' <(gzip -dc $id) | sort -n -k1,1 | cut -f1 | uniq -dc | awk '{print $2}' )'
Any idea on what it could be the problem?
解决方案
推荐阅读
- amazon-web-services - 您可以将文件设置为隐藏在 S3 存储桶中吗?
- r - 我使用 GROUPBY 然后 SUMMARIZE 将总标签添加到数据框。但是意味着总水平的百分比数据是错误的
- java - 从 Java 8 迁移到 Java 11 时无法解析 java.time.format.DateTimeParseException
- javascript - 如何使用reduce方法映射对象?
- python - 在 react app 调用的烧瓶 api 中使用 Sqlite 和 sqlalchemy 的线程和递归问题
- python - 使用 for 循环将天数添加到 pandas 中的所有日期列
- python - 如何读取复制到剪贴板 Linux 和 MacOS 的文件的绝对路径?
- html - 点击事件问题Jquery后关闭汉堡菜单
- vba - Application.ShowWindowsInTaskbar 在 Word 365 中给出“运行时错误 4609 字符串太长”。它是否已弃用?
- reactjs - 想要在部署后禁用源