Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [search]

search is used for questions relating to searching through the contents of files. For searching for filenames using the locate command use the tag locate.

0
votes
1answer
31 views

Search for files using terminal and open with preferred program when clicked?

I am not entirely sure if this is possible, but then again I am always surprised by the answers on here. With that said, Linux rules! And so do you guys! Alright, to be a little more clear, simply ...
-4
votes
2answers
45 views

Finding specific string in XML file and storing in another file [closed]

Text in input file is like this <title> <band height="21" isSplitAllowed="true" > <staticText> <reportElement x="1" y="1" ...
0
votes
2answers
50 views

Is there a way to search (grep/find) a specific word within multiple pdf files located on a specific drive?

I am trying to locate a client's pdf file that was saved on an external backup drive, which contains a little over 8000 pdf files and hundreds of folders. For example, if I want to search all pdf ...
0
votes
3answers
99 views

CLI utility to search and view/download YouTube videos

Is there a utility that can search YouTube from the command line, and then either view or download the search results according to user input? $ youtube-search madonna 1 Madonna - Hung Up (Official ...
-2
votes
1answer
33 views

Unable to search a string using more pager

I opened a file using the more pager,i was trying to find a string in this file using / as shown in the figure below,but it is saying that pattern not found even though the string i have searched is ...
0
votes
2answers
80 views

PDF reader with option to search multiple words at the time/match any of the words

Are there any PDF readers with advanced search options - searching several words at a time to be exact? Adobe has it by the name match any of the words as explained here. Regular (standard) search ...
1
vote
1answer
18 views

How to configure the “most” pager to highlight all matches on search?

I have been using the "most" pager for couple of years, but when searching and jumping and navigating between the matches ( with n and p ) the cursor is quite small (I barely notice it), so i'd like ...
2
votes
1answer
43 views

Tool for searching across branches and through history in a Git repository

I'm looking for a tool, or for suggestions towards a script, that would be able to search a Git repository for files based on both filenames and file contents (find/grep-like). It would need to be ...
2
votes
2answers
42 views

Search for three consecutive newlines?

I know that squeezing multiple blank lines can be done using cat -s (and squeezing all blank lines can be done using tr -s '\n'), but I'm curious how to search for this condition in a stream of input. ...
2
votes
1answer
510 views

How to grep '$$$$$'? [duplicate]

I want to check the absence of the following sequence of characters $$$$$ (i.e., 5 dollar signs) in a json file using grep as it has been used instead of comma to separate fields and I need to make ...
0
votes
0answers
22 views

How to create a regex matching a custom string at the beginning of line while ignoring all preceding whitespaces via ag silversearcher?

Give an example file with the content: // find me val ignore me = "" // I should not be found // find me // find me I want to find all the lines with find me using ag silversearcher. ...
1
vote
0answers
46 views

How can I search a text file Google-style? [closed]

As you know, Google is very smart with searches, while the best search terminal tool I have ever seen just allows you to search with regexes. Is there a tool to search text more like a search engine? ...
1
vote
1answer
75 views

How to search for a folder or file in parent folders [duplicate]

I tried to search for a folder in its parent folders instead of its child sub-folders (usually any search bash command will do). I need to know whether any reverse alternative for any search commands ...
1
vote
2answers
54 views

AIX Unix - How to Find and Remove files created between date period, with starting and ending characters?

I'm using IBM AIX Unix and it's limited with command option. I want to implement below filter criteria using find and mtime (which works) option. I would like to remove the files listed with below ...
1
vote
4answers
62 views

RegEx for matching strings in 2nd and 5th columns using grep

I have a file (test.txt) that contains string such as: name1,6.5.8.12,specs1,version1,['66.55.89.12'] name2,19.13.13.159,specs2,version2,['13.13.173.59'; '14.19.232.42'] name3,141.101.196.40,specs3,...
0
votes
2answers
43 views

How to check if first column's string of file1 exist in the file2?

I have two files, file1.txt contains strings separated by commas: 1.1.1.1,string1,comment1 7.7.7.7,string3,comment3 2.2.2.2,string2,comment2 88.88.88.88,string4,comment4 999.999,999,999,string5,...
0
votes
2answers
58 views

How to extract string between the first occurrence of : and a colon

I have a long file that I need to reprocess for entering it into database. The file's data are in this format: Error for: 111.222.55.1,[ZXX: Error message] some text (_xxx.c:833) Error for: 198.243....
0
votes
1answer
71 views

Find files that contain filler (0x00)

My qbitorrent was set to preallocate files. After a crash it lost a lot of torrents many of which were incomplete. (I purged it afterward, using deluge now) I have a directory containing 1000s of ...
1
vote
0answers
23 views

Configuring default output for Aptitude package search

In most flavors of Linux that I've used, the output for apt search does not include the current state display but in Linux Mint (Sylvia) it is displaying and I would like to remove it because it ...
3
votes
4answers
323 views

Extract addresses separated by semicolon and print each address in a line

I have a file with the following input. The numbers separated by dots represents addresses. Any number in address can be one or more digits as follows: [112.112.112.112;3.3.3.3;44.44.44.44] [6.6.6.6;...
0
votes
2answers
163 views

Searching for URLs with subdomains using grep

I have a file with content similar to: mail.google.com srv1.mail.google.com google.com facebook.com yahoo.com tt.twitter.com I want to search for lines with subdomains. I used this command: grep -e ...
6
votes
3answers
2k views

Search for special characters using grep

I want to search for the lines that contains any of the following characters: : / / ? # [ ] @ ! $ & ' ( ) * + , ; = % I am familiar with grep. But with this set of characters, it is a bit tricky ...
1
vote
0answers
31 views

Is there a tool for searching keywords super fast in many pdfs files?

I have a bunch of technical books, and I have been using pdfgrep for a while, but it takes substantial amount of time for searching all. can somebody recommend me of a cli tool for searching in pdf ...
1
vote
1answer
294 views

How to search for a pattern using grep?

I want to search a file to check for patterns like this: text1,text2,[1.2.3,3.4.5,6.7.8,etc] exist. The number of commas inside the square brackets is undefined. I tried the following command but it ...
2
votes
5answers
195 views

How to replace commas between brackets

I have text file that looks as follows: 12.com,128.15.8.6,TEXT1,no1,['128.15.8.6'] 23com,122.14.10.7,TEXT2,no2,['122.14.10.7'] 45.com,91.33.10.4,TEXT3,no3,['91.33.10.4'] 67.com,88.22.88.8,TEXT4,no4,['...
0
votes
4answers
35 views

How to replace the line with an exact matching of a string

I have a file with this content: dskldfsd.com domain domain.com sub.domain.com domain.main.com anythinghere I want to delete the line which contains the word domain. Using grep, this command ...
0
votes
2answers
25 views

search substring within a string and return next word

I have this string where I want to search for a keyword and then return the following word. "SELECT \"city\",\"temp_lo\",\"temp_hi\",\"date\" FROM schema_name.\"weather_7\"" I want to return "...
2
votes
4answers
287 views

How to extract columns before and after a string ocurrence

I have a text file. That looks like: www.ac.com has address 6.1.1.146 www.ac.com is an alias for ac.com. www.ac.com is an alias for ac.com. www.ba.net is an alias for www-bn.gs.ba.com. www-bn.gs.ba....
0
votes
2answers
67 views

How to query all lines in a file that are NOT equal or suffix of any name in another file

I have two files file1 and file2. The two files contain names. One name in each line. I want to query all names in file2 that are not equal to or a suffix of name in file1. Note that the prefix is ...
-1
votes
2answers
869 views

grep to extract lines that contains full domain names from a file [closed]

I have a large file that contains domain names in the form of: domain.com sub.domain.com sub.domain.co.uk domain.co.uk I want to extract main domain names (no sub domains) with top level domain name ...
0
votes
1answer
37 views

How can I search a string in a pdf file, and find the physical page number of each page where the string appears?

Given a PDF file, I would like to search for a string in its text, and I know pdfgrep can do that. I further would like to have the physical page number of each page where the string appears (as ...
-1
votes
1answer
45 views

Using egrep in /var/spool/postfix returns no results

My machine is using CentOS 7.1. I'm trying to search through all the files within /var/spool/postfix. The way I'm trying to achieve this is with: $ egrep -lir --include="*.*" "somemail@somedomain....
0
votes
1answer
62 views

Extracting lines that has match in the first column? [duplicate]

I have two files: file 1: a,txt1,v1 b,txt2,v2 c,txt3,v1 d,txt4,v2 file2: a,txt5,v2 b,txt6,v1 xc,txt7,v1 xd,txt8,v2 I want to refine the files. I only need the lines where the 1st column in file1 ...
0
votes
1answer
45 views

comparing 1st and 3rd column value in two files [closed]

I use Ubuntu 18 and have little experience with Linux commands. I have two files: file 1: a,txt1,v1 b,txt2,v2 c,txt3,v1 d,txt4,v2 file2: a,txt5,v2 b,txt6,v1 c,txt7,v1 d,txt8,v2 I want to print ...
1
vote
1answer
455 views

ripgrep: print only filenames matching pattern

Using ripgrep (rg), can I print only the filenames which match a given pattern? There are two separate things I'm trying to do: Match the pattern to the pathname itself (like ag -g pattern) Match ...
0
votes
0answers
43 views

ag: search ignored files but not binary files

In ag (The Silver Searcher), how can I search through all files, including ignored files, but excluding binary files? The only option which includes ignored files seems to pull in binary files also: ...
2
votes
2answers
98 views

Recursively grep through epub files

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 ...
1
vote
1answer
80 views

How to Replace a string by another in a text file

I would like to replace a given string in a text file into by another, but with one extra detail. Example: If the file content's is : Library Hello1 =============== any text here version: 0.1 ------...
0
votes
4answers
117 views

Grep a pattern from a file and get that whole word, not just the pattern

List item I/P: abcd_Server1 CCDDomain defg_Server1 GGFDomain kdkhs_Server1 CCDDomain abce_Server1 CCDDomain dgdg_Server1 CCADomain dfdkhs_Server1 GGFDomain I need to search for the word "Domain" ...
1
vote
1answer
137 views

Escaping characters in command line search and replace [duplicate]

In Unix (running MacOS High Sierra), I've seen a few different search/replace (over several files) methods, e.g.: perl -pi -w -e 's/SEARCH_FOR/REPLACE_WITH/g;' *.txt or using sed or grep, etc. The ...
0
votes
1answer
59 views

How do I grep many files for many strings?

I have a file with many strings. For simplicity, assume it is newline-delimited, and that each string is made up of only contain alphanumeric ASCII characters and underscore. Now, I want to search a ...
1
vote
0answers
26 views

Index and search a directory

I have a directory tree containing many text-files. I would like to index the full-text of all these files (ignoring files with certain file-extensions), so that I can quickly search thorugh all of ...
0
votes
3answers
687 views

find user name through full name / gecos field?

Given a system where the user data comes from e.g. an OpenLDAP database and is not in the /etc/passwd file. Is it possible to search through the getent passwd database and look up the user id/name by ...
3
votes
2answers
59 views

How to pass a search pattern starting with $ to less on the command line

I just tried to pass a search pattern starting with $ to less: less +/'\$l' myfile.pl and I got There is no -l option ("less --help" for help) After reading the manual, I tried the alternate -p-...
1
vote
1answer
48 views

using grep to exclude results not matching specific query

I created a file (testimdb) with the following content: film: heat. year: 1995. director: michael mann. actors: al pacino, robert de niro, val kilmer film: the godfather part ii. year: 1974. ...
0
votes
2answers
101 views

How to search through and list files that do not contain specific phrase [duplicate]

I am running the same job on around 1000 input files. Around 10% of these will fail, but the only way of checking this is to scroll through the output files and check if it states completed without ...
0
votes
1answer
23 views

search which other python files invoke a class defined in an given pythonfile

There is a set of python files in a folder. One file includes a class definition, for instance Class DataGen: How can I know which python file in this folder use this Class? Are there any linux ...
-2
votes
2answers
122 views

How to organize installed programs in $HOME for shell to search for them when running them? [closed]

I have written or downloaded some programs ( bash scripts, python scripts, java programs, C programs) and placed them under /home/t/program_files/. For each program, I create a directory under the ...
2
votes
1answer
118 views

What limits Kate text editor search feature?

I am fairly new with Kate, started to use it, because it's search feature shows the number of occurrences found. But now I found a problem with search. It works fine for few line files (few hundreds) ...
0
votes
1answer
39 views

Search list of names and their values from a file to another files?

I have two .csv files. First file has one column of list of names and second file has sixty columns including names and their values in all columns. I am looking to search names from first file to ...