问题标签 [comm]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
100 浏览

arduino - 允许我通过通信端口更改状态的 Arduino 程序?

新来的!多次被推荐来这里寻求帮助,所以我在这里。

我应该编写一个程序,允许我通过通信端口更改闪烁 LED 灯的速率。我敢肯定这很容易,但老实说我不知道​​,因为我在这门课上落后了。

任何事情都会有帮助,老实说,我想学习如何做到这一点,而不仅仅是来这里得到答案。

先谢谢了!

0 投票
1 回答
92 浏览

php - Shell - diff between files and parameters in each line

I am looking for advance two file compare shell/bash/php. Let say i have such files:

file1

file2

get the difference between those files (ignoring line order) that is

but that is not all, i want to check if there was same (.run file=name) in the old file and if it was then get it's (rev=number). So that the final output will look like this:

file3:

so far: fgrep -x -v -f file1 file2

gets

0 投票
1 回答
69 浏览

bash - Unix:比较两个 TXT 文件问题并保留不唯一的行

我有两个TXT文件

我比较了1.txtto并得到了 与 比较时2.txt不在的 IP 。我做到了,2.txt1.txt

输出

Out.txtIP是不在2.txt文件中的IP。

现在,我想比较1.txt2.txt得到一个不是唯一的1.txt

预期结果

如何在我的输出结果中包含 ID?

0 投票
2 回答
2538 浏览

bash - 没有排序的两个文件之间的差异

我有文件file1file2,其中file2file1. 这意味着,如果我遍历file1,则有些行在 in file2,有些则不在,但没有行 infile2不在 in file1。一个文件中可能有几行内容相同。现在我想了解它们之间的区别,即所有行file1都不在file2.

根据这个广受欢迎的答案

diff(1) 不是答案, comm(1) 是。

(无论出于何种原因)

但据我了解,comm需要先对文件进行排序。问题:两个文件都是有序的(没有排序!),并且需要保持这个顺序。所以我真正想要的是迭代file1,并检查每一行,如果它也在file2. 如果没有,请将其写入file3. 如果相同的内容出现不止一次,就应该保留不止一次!

有没有办法用命令行来做到这一点?

0 投票
1 回答
100 浏览

api - 使用 spark-kernel 通信 API

我最近开始使用 spark-kernel。

如教程和示例代码中所述,我能够设置客户端并将其用于在 spark-kernel 上执行代码片段并检索本示例代码中给出的结果。

现在,我需要使用 spark-kernel 提供的 comm API。我试过这个教程,但我无法让它工作。事实上,我不知道如何使它工作。

我尝试了以下代码,但是当我运行此代码时,我在内核上收到此错误“Received invalid target for Comm Open: my_target”。

有人可以告诉我如何运行这段代码:

如果有人能指点我完成有关使用 comm API 的工作示例,我将不胜感激。

任何帮助将不胜感激。谢谢

0 投票
1 回答
49 浏览

batch-file - 将文件与上次修改的文件进行比较,将 Mod 输出为 .TXT 文件

我需要在 Windows 2003 服务器中创建一个批处理文件。我们确实安装了 Cygwin,因此能够运行 unix 命令。

每天晚上,一个进程会将一个带时间戳的文件 FILE*%yyyy%%mm%%dd% .txt下载到c:\temp\download

然后 FTP 进程会将其 FTP 到另一个位置并将文件移动到c:\temp\download\archived

我们正在尝试完成的是,在 ftping 之前,将文件与 c:\temp\download 中的新文件与 c:\temp\download\archived 中的最后修改文件进行比较,以便仅 ftp 已更改的行自上一个文件上传以来。当前日期 txt 文件应仅包含与前几天不同的行。

我已成功运行以下脚本来对两个文件进行排序和比较:

该脚本在没有排序的情况下工作,但一旦添加,脚本就会失败。

运行comm -2 -3 %archive%\%oldfile% %download%\%newfile%有效,但添加排序时无效,并出现错误:

comm -2 -3 C:\temp\download\archived\CPSNS_20140527075503.txt) C:\temp\download\CPSNS_20140602075502.txt) 0<(sort 1>c:\temp\download\workplease.txt 系统找不到指定的文件。

任何帮助将不胜感激!

0 投票
3 回答
2190 浏览

bash - 使用 COMM 和 SORT 的 Bash 脚本在意外标记附近出现语法错误

Linux,CentOS - 比较我使用命令的 2 个文件

它适用于 shell,但是当我尝试创建一个 bash 文件时 - 我有

脚本最简单

我已经尝试过转义圆括号的变体,例如

或者

但是这个案例外壳说

我尝试使用绝对路径

同样的结果“没有这样的文件”

我已经尝试过运行脚本的变体,例如

还是一样的问题。

所以我有或“没有这样的文件......”与括号转义 - 或“意外的令牌”在其他情况下。

提前感谢您尝试任何想法,可能应该是正确的语法“组合”?

0 投票
2 回答
682 浏览

bash - Unix 使用 comm 比较两个 CSV 文件

我有两个 CSV 文件。1.csv文件有 718 个条目,2.csv有 68000 个条目。

我知道如何比较两个文件,当两者中只有一列(Names)可用并获得匹配时names

现在我想检查一下,如果Numin1.csvNumin匹配,则匹配的两个文件中 2.csv关联的“名称”是 什么?csvNum

如何做到这一点使用comm

0 投票
4 回答
293 浏览

perl - 如何跨多个文件提取公共行?

我有 15 个不同的文件,我想要一个新文件,其中只包含公共行。例如:

我知道这个命令适用于每对文件:

grep -w -f 文件 1 文件 2 > 输出

但我需要一个命令来处理超过 2 个文件。

请问有什么建议吗?

0 投票
2 回答
1964 浏览

bash - BASH comm command, but for multiple columns

I am looking for something similar to the bash command comm, that I can use to select entries both unique to my 2 files and common to them. Comm worked great when I had just one column per file, eg.

But now I have multiple columns of info I wish to keep. I want to select column 2 as the one to filter rows for unique and common entries between my two files. If the entry in column two appears in both files I also want to record the info in columns 3,4,and 5 (if possible, this is not as important). Here is an example of input and output.

Output wanted:

I know there has been similar questions before but I can't quite find what I'm looking for. Any ideas greatly appreciated, thank you.