grep's questions - English 1answer

2.986 grep questions.

This question is similar to: Using grep to identify incorrect titles. I have some titles that start with # (as they are markdown), and I have the two following rules: titles (#) should have exactly ...

I have a single text file. It's a multiple choice exam. In it are several hundred questions, each with four answer choices, one per line, that start with A. B. C. D. After each A. (and B. etc) ...

I have a text file with > 20.000 lines, like this: 7 128550681 128550681 Intron:1:36:RETAINED-RETAINED;Transcript:NM_001135914.1;Gene:KCP:protein_coding 1 1 0 0 1 17718672 17718672 ...

I have several hundred documents where each title is of the form: # Some title here {.WORD} I want to identify using grep every title that does not follow this standard. However, lines starting ...

grep -c is useful for finding how many times a string occurs in a file, but it only counts each occurence once per line. How to count multiple occurences per line? I'm looking for something more ...

I want to find three patterns in a list. I tried typing $ pip3 list | grep -ei foo -ei bar -ei baz but the shell throws a broken pipe error and a large Traceback. How do I grep for multiple ...

I have 2 input files. Input file1 looks like this Equus caballus Monodelphis domestica Saccharomyces cerevisiae S288c Input2 looks like this(showing first 10 lines) >CM000377.2/60448635-60448529 ...

I have multiple text file around 2000 text file in folder. I want to remove those file which are blank file.

Input file 1 2 3 1 4 5 6 1 1 2 34 5 6 2 I want output like this 1 2 3 4 5 6 34 ( all the duplicate number should print only once )

Ubuntu 16.04 bash -version GNU bash, version 4.4.0(1)-release (x86_64-unknown-linux-gnu) I would like to grep for 2 patterns and then have them listed side by side. ATM, this is what I have: root@...

Very new to UNIX but not new to programming. Using Terminal on MacBook. For the purposes of managing and searching word lists for crossword construction, I'm trying to get handy with the Grep command ...

I want to extract the logs between the current time stamp and 15 minutes before and sent an email to the people configured. I developed the below script but it's not working properly; can someone help ...

aaaaaaaa 09 bbbbbbbb 90 ccccccccccccccc 89 ddddd 09 Using sed/awk/replace, in the above text I want to remove anything that comes after the first space in each line. For example the output ...

I have noticed that when I do not specify a list of files for grep to search through, grep is much slower than when specifying filenames (even if the list is *, i.e. all the files in a directory). ...

Why in the following (e)grep attempts, egrep is unable to identify the end-of-word delimiter? (b)? $ echo -n "my-pc is beautiful" | egrep 'my-pc\b' my-pc is beautiful /home/pkaramol $ echo -n "my-pc-...

i have 2 file : file 1: abc mno pqd file 2: ump 10 abc 12 sfg 30 klp 45 mno 21 pqd 32 jkl 98 lkg 45 I want output like this: abc 12 mno 21 pqd 32

I need to search a folder of gzipped files for a string, however I need to search starting at the bottom of each file. I then need the command to return results when it has 10 total matches across ...

I have an assignment where I need to extract data from a pcap file. This is what the file looks like: The question is, Find cipher suites offered by clients in TLS. I know that the cipher suites I am ...

I'm trying to do simple grep and grep -v so I will get the lines from a.txt that exists in b.txt and not in c.txt. Example of 3 files a.txt: a b c d e up.txt: a.up b.up c.up dw.txt: a.dw b.dw ...

I have a file like: file.foo file2.foo file.bar file3.foo Now I want to return only lines that end with .foo, but I want to rename all occurrences of file with blag. In this case that means skipping ...

We want to search the following line recursive under folder/s awk '{print}'|grep -i -e 'port is up' -e 'valid output' so we did that: grep -r "awk '{print}'|grep -i -e 'port is up' -e 'valid output'...

I have two files that need to be merged into one. File 1 example: gene_1 578 gene_2 565 gene_3 3 gene_4 77 gene_5 8 gene_6 0 gene_7 45 gene_8 67 gene_9 0 gene_10 65 File2 example: COG0430 ...

I have a file in which I have to search for a word and as soon as I find that word , I have to keep that record in my output and also I need to go back from that record and take a previous record as ...

I have many files and I want to export certain lines to new files while maintaining the input files as they are. For example, I want all lines beginning with a to be sent to a new file, let's call ...

I am looking to only grab images from a document with a certain path; for example: example.com/uploads/287167/file_name.jpg and only grab those with the uploads/number/filename. I am currently ...

I have two files : file1 and file2. The content of both files is the following file1: Hello file2: Bla bla bla bla Hello Bla Bla bla bla bla My objective is to see if I can find an exact match of ...

Is it possible to substitute a sample recursively in multi directory with grep and sed like that ? grep -e "http://localhost:4000" -r ~/dev_web/_site | sed -e 's/http:\/\/localhost:4000/https:\/\/...

I am trying to grep for a regular expression which contains a specific date as a string "2018-07-02" and the string "POST". I want to return only lines which contain both of the strings. So far I ...

I'm migrating to Linux, and I need to convert the following Windows cmd command: fc file1.txt file2.txt | find /i "no se han encontrado diferencias" > nul && set equal=yes I think fc can ...

I have a log file which contain lots of line like below: 2017-07-16 01:06:07 | 8801624874139 | http://192.168.5.1:2020/credit/purchase/4 | XpressLoan | {"resultCode":0,"resultMessage":"OK","amount":...

I am creating ftp.log.processid at run time via my script now i need to grep this file for a word 'get' grep -i "get" $ftp_log.$! I am using the above expression - but it always shows no such file ...

I tried the answers here, but without luck. find . -name "*.epub" -exec zipgrep pattern {} \; showed me "matched", but didn't give me the matching epub file back. Also, it returned huge blobs of ...

Example of string blah:blah:example - 1234 blah1:blah2:example2 - 3213 What I want to check exists - 1234 but numeric can be different I know I can use awk -F: '$3 ~ / - /' to check if " - " ...

So I'm relatively new to command line. I was able to use find to get an output of multiple files from multiple directories since there was no specific place these would be (I'm sure this can be ...

If I do: $ ls -R .: 4Shared/ Cloud/ ./4Shared: UFAIZLV2R7.part3.rar ./Cloud: UFAIZLV2R7.part2.rar.part UFAIZLV2R7.part1.rar.part UFAIZLV2R7.part4.rar.part If I want to list the .rar files only, ...

I have a situation where I'm trying to install software into my system. I'm using a fakeroot approach to install them in a separate directory where I'm listing all the files, directories and links ...

hello how to remove and clear output ? test.txt http://urlcom/longStringxyzABC**|**http://urlcom/longStringxyzABC i want, | including character deletion after i want result http://urlcom/...

The logs are in the format: 2018-06-25 00:00:20,073 DEBUG SAMPLE TEXT CONTENT 2018-06-26 00:00:20,073 ERROR SAMPLE TEXT CONTENT 2018-06-26 17:37:20,073 ERROR SAMPLE TEXT CONTENT 2018-06-26 19:00:20,...

I am having a log file which contains many months and I want to extract all the logs from one month. The log file line starts like this 2018-05-31 12:30:00 INFO: 2018-06-18 12:31:00 INFO: 2018-07-32 ...

ip a | egrep '([0-9]{1,3}\.){3}[0-9]{1,3}|enp0s' | grep -e 10 -e 172 -e 192 | awk '{print $2}' | awk '{gsub("/24", "");print}' | xargs The above command gives the output as: enp0s3: 10.0.2.15 enp0s8:...

ip a | egrep '([0-9]{1,3}\.){3}[0-9]{1,3}' Can somebody explain what the above command will do?

I would like to grep a log file on a remote server using a pattern with spaces, eg. grep 'words with spaces' log.txt The tricky part is that I'm executing a remote dockcli command over ssh. ...

When I search for some process that doesn't exist, e.g. $ ps aux | grep fnord wayne 15745 0.0 0.0 13580 928 pts/6 S+ 03:58 0:00 grep fnord Obviously I don't ...

I have following text in a text file $ cat test 20180618: 20180619: 20180620: 20180621: 20180622: 20180623: 20180624: I have tried to grep with the range of numbers like below, $ grep 201806{19..21}...

I have 10GB files in which i want to count occurrence of some specific text i.e TY[0-9]. File format is like : ABC,2A,2018-07-06,2018-06-20 00:00:00 BCD,TY1,2018-07-06,2018-06-20 00:00:00 EFG,TY2,...

Level 1, beginner here. Question about grep and maillog. I have a learning environment, based on Linux CentOS, with Postfix and SquirrelMail running, but my assignment is more in general. I need to ...

I'm trying grep 7 lines after match and replace a context in those 7 lines and save it in the same file. For Example: <IfModule prefork.c> StartServers 8 MinSpareServers 5 ...

I want to look for lines with "word1 ... word2" where '...' could be any different characters. So far I have used two greps for the same like this: grep "$word1" $filename | grep "$word2" Is there a ...

I have a text file like the one below although with almost many columns. I want to extract column names that have a specific proportion/number of TRUE values, for example columns with TRUE in 2 out of ...

I have a file roughly like header_one param1 param2 ... data_one data1 data2 data3 data4 ... header_two param1 param2 ... data_two data1 data2 data3 data4 I'd like to extract all header blocks ...

Related tags

Hot questions

Language

Popular Tags