ack

ack regex: Matching two words in order in the same line

拥有回忆 提交于 2019-11-29 10:56:37
问题 I would like to find lines in files that include two words, word_1 and word_2 in order, such as in Line A below, but not as in Line B or Line C : Line A: ... word_1 .... word_2 .... Line B: ... word_1 .... Line C: ... word_2 .... I have tried $ack '*word_1*word_2' $ack '(word_1)+*(word_2)+' and the same commands with ^ appended at the beginning of the regex (in an attempt to follow the Perl regex syntax). None of these commands return the files or the lines I am interested in. What am I doing

How to let ack support more filetypes?

烈酒焚心 提交于 2019-11-29 01:26:25
问题 in ack's home page, there lists a lot of file type, but without aspx, is it possible to let ack support it? 回答1: On window,add .ackrc file under C:\Documents and Settings\yourname,with content --type-set=aspx=.aspx you can set a type to multi file extension,seperate by "," --type-set=aspx=.aspx,.ascx Note ack syntax and behaviour has changed significantly with version 2. The equivalent of the above in version 2 would be: --type-set=aspx:ext:aspx,ascx Where the syntax is --type-set TYPE:FILTER

How do I run programs with Strawberry Perl?

房东的猫 提交于 2019-11-28 21:10:21
A coworker is trying to use ack (a Perl program) on his Windows machine, having tried it under Linux and decided he definitely wants to use it. He managed to get Strawberry Perl installed on his machine, but can't seem to figure out what to do to make ack run with it from a command prompt. He tried editing the #! line, but I knew that wouldn't work. I'm pretty sure Strawberry perl is in his PATH. What do you need to do to run a general Perl program in your PATH on Windows using Strawberry? Update: I'm seeing some information online about the PATHEXT variable, but not enough. First, be careful

How to exclude several lines around match with grep or similar tool?

爱⌒轻易说出口 提交于 2019-11-28 09:46:49
问题 I can find all non-matched lines of file with grep -v 'my_pattern' some_file . Also i can print few strings before/after/around match with -A , -B or -C options of grep. But i can't combine these two options to exclude lines with pattern and certain amount of lines near matched lines - grep shows entire file as result. For example, i have log with a lot of patterns like this: 25.02.2012 10:41:37 here goes memory state 25MiB free 16MiB allocated max free block is 4MiB I'd like to filter them.

How to do search & replace with ack in vim?

蹲街弑〆低调 提交于 2019-11-28 02:53:55
I am using the Ack plugin in Vim, which helps me to quickly search for strings in my project. However, sometimes I want to replace all or some occurrences of the found strings. You can do some kind of global search and replace using the Vim arglist like this ( source ) : :args app/views/*/* :argdo %s/, :expire.*)/)/ge | update But instead of using args , I would prefer to do a search via Ack and then do the replace in all files that have been found. Is there a way to do it similar to the argdo command? I've decided to use ack and Perl to solve this problem outside of Vim so I could use the

Obtain patterns in one file from another using ack or awk or better way than grep?

自闭症网瘾萝莉.ら 提交于 2019-11-27 23:16:07
Is there a way to obtain patterns in one file (a list of patterns) from another file using ack as the -f option in grep ? I see there is an -f option in ack but it's different with the -f in grep . Perhaps an example will give you a better idea. Suppose I have file1: file1: a c e And file2: file2: a 1 b 2 c 3 d 4 e 5 And I want to obtain all the patterns in file1 from file2 to give: a 1 c 3 e 5 Can ack do this? Otherwise, is there a better way to handle the job (such like awk or using hash) because I have millions of records in both files and really need an efficient way to complete? Thanks!

TCP/IP协议 三次握手与四次挥手

限于喜欢 提交于 2019-11-27 12:04:02
一、TCP报文格式 TCP/IP协议的详细信息参看《TCP/IP协议详解》三卷本。下面是TCP报文格式图: 图1 TCP报文格式 上图中有几个字段需要重点介绍下: (1)序号:Seq序号,占32位,用来标识从TCP源端向目的端发送的字节流,发起方发送数据时对此进行标记。 (2)确认序号:Ack序号,占32位,只有ACK标志位为1时,确认序号字段才有效,Ack=Seq+1。 (3)标志位:共6个,即URG、ACK、PSH、RST、SYN、FIN等,具体含义如下: (A)URG:紧急指针(urgent pointer)有效。 (B)ACK:确认序号有效。 (C)PSH:接收方应该尽快将这个报文交给应用层。 (D)RST:重置连接。 (E)SYN:发起一个新连接。 (F)FIN:释放一个连接。 需要注意的是: (A)不要将确认序号Ack与标志位中的ACK搞混了。 (B)确认方Ack=发起方Req+1,两端配对。 二、三次握手 所谓三次握手(Three-Way Handshake)即建立TCP连接,就是指建立一个TCP连接时,需要客户端和服务端总共发送3个包以确认连接的建立。 在socket编程中, 这一过程由客户端执行connect来触发,整个流程如下图所示: 图2 TCP三次握手 (1)第一次握手:Client将标志位SYN置为1,随机产生一个值seq=J

How to do search & replace with ack in vim?

匆匆过客 提交于 2019-11-26 23:52:23
问题 I am using the Ack plugin in Vim, which helps me to quickly search for strings in my project. However, sometimes I want to replace all or some occurrences of the found strings. You can do some kind of global search and replace using the Vim arglist like this (source) : :args app/views/*/* :argdo %s/, :expire.*)/)/ge | update But instead of using args , I would prefer to do a search via Ack and then do the replace in all files that have been found. Is there a way to do it similar to the argdo

Obtain patterns in one file from another using ack or awk or better way than grep?

冷暖自知 提交于 2019-11-26 23:18:31
问题 Is there a way to obtain patterns in one file (a list of patterns) from another file using ack as the -f option in grep ? I see there is an -f option in ack but it's different with the -f in grep . Perhaps an example will give you a better idea. Suppose I have file1: file1: a c e And file2: file2: a 1 b 2 c 3 d 4 e 5 And I want to obtain all the patterns in file1 from file2 to give: a 1 c 3 e 5 Can ack do this? Otherwise, is there a better way to handle the job (such like awk or using hash)