首页 \ 问答 \ 计算多个文件中多个字符串的出现次数(Counting occurrences of multiple strings in multiple files)

计算多个文件中多个字符串的出现次数(Counting occurrences of multiple strings in multiple files)

我在一个文件夹中有多个文本文件。 对于每一个,我想搜索3个不同的字符串并将这些字符串的计数加在一起,然后将它们输出到文件中。

这适用于计算不同文件中的单个字符串:

for /f "delims==" %%a in ('dir /b "%CD%\*.txt"') do findstr /r /n "^.*SEARCH_STRING_1.*$" "%%~dpnxa" | find /c "SEARCH_STRING_1" >> "%%~dpacounts.txt"

这会导致文件中的每个文件都有一个新行的计数。 如何搜索“SEARCH_STRING_1”,“SEARCH_STRING_2”和“SEARCH_STRING_3”,将计数一起添加,并以相同的方式将它们输出到文件中?


I've got multiple text files in a folder. For each one, I want to search for 3 different strings and add the counts of those strings together, then output them to a file.

This works for counting a single string in the different files:

for /f "delims==" %%a in ('dir /b "%CD%\*.txt"') do findstr /r /n "^.*SEARCH_STRING_1.*$" "%%~dpnxa" | find /c "SEARCH_STRING_1" >> "%%~dpacounts.txt"

This results in a file with a count on a new line for each file in the folder. How can I search for "SEARCH_STRING_1", "SEARCH_STRING_2" and "SEARCH_STRING_3", add the counts together, and output them to the file the same way?


原文:
更新时间:2022-05-13 07:05

最满意答案

我觉得你有点困惑, coturn 不是信号服务器 ,它是TURN / STUN服务器。

信令服务器是你在获得直接对等连接之前在对等体之间交换sdp,ice候选者和其他数据的东西,但是coturn不这样做。

我无法解释所有的比特,但是gist是STUN用于提供对等体的公共IP,而TURN用于代理点,用于在无法直接访问时从对等体发送和接收数据,并且在大多数情况下,所有你require是一个STUN服务器。 他们参与WebRTC应用程序的唯一时间是在创建PeerConnection对象时,您在配置对象中传递STUN / TURN服务器详细信息,例如:

let pc = new RTCPeerConnection({
  "iceServers": [
    {"urls": "stun:example.com"},  // STUN Server address
    {"urls": "turn:example.com", "credential": "test", "username": "test"}  // TURN Server address
  ] 
}); 

I think you are bit confused, coturn is not a signalling server, it is a TURN/ STUN server.

Signalling server is something though which you exchange sdp, ice candidates and other data between the peers before they get a direct peer to peer connection, coturn does not do that.

I cannot explain all the bits, but gist is STUN is used for providing public IP of a peer, and TURN is used for a proxy point for transmitting and receving data from a peer when it cannot be directly accessed, and in most cases all you require is a STUN server. The only time they get involved in your WebRTC application is when you create the PeerConnection object, you pass the STUN/TURN server details in the config object, example:

let pc = new RTCPeerConnection({
  "iceServers": [
    {"urls": "stun:example.com"},  // STUN Server address
    {"urls": "turn:example.com", "credential": "test", "username": "test"}  // TURN Server address
  ] 
}); 

相关问答

更多
  • 我认为问题可能是URL配置。 而不是'url',你应该使用'urls'。 iceServers: [ { urls: 'stun:stun.l.google.com:19302' }, { urls: self.config.turn.host, username: self.config.turn.username, password: self.config.turn.password }] '网址'已被弃用。 请参阅此处了 ...
  • 转弯服务器独立于SIP服务器。 您无需在freeswitch上设置TURN的任何内容。 您只需为您的webrtc客户端设置转弯服务器地址即可。 The turn server is independent of the sip server. You don't have to setup anything about TURN on freeswitch. You just have to set your turn server address for your webrtc client.
  • Coturn是非常流行的晕/转服务器,积极的社区支持。 预构建的软件包可在https://github.com/coturn/coturn/wiki/Downloads上找到 您可以使用示例演示来测试服务器 如果双方都在同一个网络中,则不需要配置诸如凭证之类的东西。 阅读更多 Configuring the peerConnection: STUN server: //server_ip is coturn instance ip should be reachable from clients var ...
  • 1>使用PJSIP它拥有您请求的所有项目,现在可以在iOS上正确构建 2>没有 3>我不知道,但PJSIP有STUN,TURN和ICE库及其模块化 below are answer to my own queries Is there any open source iOS (library) which support the same? -Yes, resiprocate source code is available , it has nicer folder. it can be compiled ...
  • 看一下Internet网关设备协议 。 是UPNP协议的扩展,非常容易使用,几乎每个路由器都支持,并且有一些免费的lib实现此协议。 Take a look at the Internet Gateway Device Protocol. Is is an extension to the UPNP protocol, is very easy to use, is supported by pretty much every router out there and there are some free ...
  • WebRTC有以下两个主要的API getUserMedia:捕获音频/视频等 peerConnection:使用信令消息(提供/应答/候选)建立对等体之间的通信信道以发送媒体/数据。 所以我们需要一个频道来在同伴之间传递这些提议/答案/候选人。 WebRTC独立于此comm通道,因此您可以选择WebSocket / Ajax / RestAPI / IM ... 首先尝试基本演示 ,它在没有任何信令通道的情况下工作,因为两个对等体都在同一窗口中 AppRTC演示是基于房间的,两个对等体应该使用相同的roo ...
  • 实际上你不需要编写自己的STUN / TURN服务器 有很多现成的解决方案,尤其是这个非常好的https://github.com/coturn/coturn/ 。 TURN是STUN的扩展,因此TURN服务器也支持所有STUN操作 您需要的是在某些服务器上安装转向服务器并将WebRTC应用程序放入其中 Actually you don't need to write your own STUN/TURN server There are lots of ready solutions, especiall ...
  • 除非您让浏览器知道KMS的配置,否则浏览器和KMS的STUN / TURN配置无关。 webrtcendpoint.conf.ini的内容仅用于媒体服务器以发现它自己的ICE候选者。 如果没有为客户端定义STUN / TURN服务器,则不会使用任何服务器。 如果您没有在客户端中定义自己的STUN / TURN配置,Kurento-utils-js库将使用FreeICE 。 STUN/TURN configuration from browser and KMS are not related, unless ...
  • 我觉得你有点困惑, coturn 不是信号服务器 ,它是TURN / STUN服务器。 信令服务器是你在获得直接对等连接之前在对等体之间交换sdp,ice候选者和其他数据的东西,但是coturn不这样做。 我无法解释所有的比特,但是gist是STUN用于提供对等体的公共IP,而TURN用于代理点,用于在无法直接访问时从对等体发送和接收数据,并且在大多数情况下,所有你require是一个STUN服务器。 他们参与WebRTC应用程序的唯一时间是在创建PeerConnection对象时,您在配置对象中传递STU ...
  • 从评论链中,听起来像Android应用程序是对称NAT的背后。 这通常是需要TURN服务器的原因; 对称NAT后面的端点不能直接与另一个对称NAT或端口限制NAT进行通信。 所以,假设这是正在发生的事情,你无能为力; 这是您需要TURN服务器的情况之一。 From the comment chain, it sounds like the Android app was behind a symmetric NAT. This is usually what makes a TURN server nece ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)