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.

Filter by
Sorted by
Tagged with
1
vote
1answer
27 views

Search files by specific time e.g. changed in the last 14 days

I am using Nextcloud and since the "retention" app is still not working on v20 I try to code an autodelete script for myself. The problem is, when I upload files to the Nextcloud share the ...
0
votes
1answer
44 views

How to locate a file created through the eXist-db database tool eXide?

I'm trying to find a specific file: note.xml which eXide would seem to have saved. Where is it? I've tried: sudo find / -iname \*.xml | grep note and a few varieties. Perhaps it's not "saved&...
0
votes
1answer
30 views

How to use tree with grep and find to locate files by name?

How can I use tree and either grep or find in conjunction to find, for example, csv files using ".csv" as a file extension: ├── ./Videos ├── ./vscode │   ├── ./vscode/foo.csv │   ├── ./...
2
votes
0answers
19 views

Less stopped saving search history

less used to save my search history to $HOME/.lesshst. A few days ago it stopped saving any new search patterns. I still see the old search patterns in $HOME/.lesshst, but the new ones are not saved ...
1
vote
2answers
84 views

Find duplicate files based on first few characters of filename

I am looking for a way in Linux shell, preferably bash to find duplicates of files based on first few letters of the filenames. Where this would be useful: I build mod packs for Minecraft. As of 1.14....
0
votes
1answer
29 views

Operate on all files under a folder that are larger than some size [duplicate]

I'm working with some PhotoRec output files, and I'm only interested in files that are larger than a certain size threshold let's say 10M. I've found ways to sort recursively in other posts (Sorting ...
1
vote
1answer
32 views

Match contents of first file with second to generate third file

Sample data of my first file first.txt is below: 10.0.0.1,Web Server,comments1,jboss is older version,myappcode1 10.0.0.3,Web Server,comments4,httpd is latest version,myappcode15 10.0.0.7,Web Server,...
-1
votes
1answer
51 views

How to search for lines that fulfill more than one criterion in Unix?

I want to find the number of the lines that have both words/patterns "gene" and "+" in them. Is this possible to do this with grep?
0
votes
2answers
42 views

regex fails when trying to match whole word

Here is my test file test.txt hello user1 ALL=(ALL) NOPASSWD: /usr/bin/* /app/tomcat/tomcat*/webapps/*, /usr/bin/rm -rf /app/tomcat/tomcat*/webapps/*,/bin/rm -rf /app/tomcat/tomcat*/webapps/**.sh , /...
0
votes
2answers
43 views

Unable to grep for the version from the output

I have a script that gives the below output: WVER0010I: Copyright (c) IBM Corporation 2002, 2012; All rights reserved. WVER0012I: VersionInfo reporter version 1.15.1.48, dated 2/8/12 -----------------...
1
vote
0answers
32 views

Is it possible to make a database file out of a project directory(containing C files)?

My requirement is to improve time for a pattern search (using grep or any other search tool) in a source code directory containing mainly C source files. I have a big code base that makes it difficult ...
0
votes
1answer
34 views

Get % of how much of a javascript file is commented out

I'm wanting to check if files are more than 50% commented out with javascript style commenting of //. My idea is to count the number of lines in the file and then count the number of // and do some ...
-2
votes
2answers
37 views

Search a string after a match

Is there any way to search a string after given match ? e.g. If I run dmidecode then it will give a lot of information. e.g. BIOS Information Vendor: ABCD Version: 123456(V1.01) Release ...
-1
votes
6answers
108 views

How to grep multiple strings in different lines from an entire directory and sub directories on Linux terminal?

I want to match a pattern that have "John" & "Riya" & "bug". Example_1: //This file should match. Hi John, How are you? Riya, what is your age? Fix this bug by ...
3
votes
1answer
26 views

How to execute ctrl+r query as-is instead of a match?

Sometimes when I reverse-search cmd in a shell I don't find a correct match and just want to execute search query as it is. Is there a way in bash/zsh and friends to execute it without discarding ...
-1
votes
2answers
87 views

How would I use the find command to display files containing a word?

I want to use the find command and only output the files in the console with their path that the find command actually found. Cause if I now use the command it will also display all the files it ...
0
votes
0answers
20 views

How to highlight all search results in xfce4-terminal

I want to highlight all matched text on terminal page, but embedded search only highlights first match. How can I fix this?
0
votes
1answer
45 views

How do I make a Caps Lock from a Seach Button?

So, I got a Lenovo Chromebook running the latest ubuntu Mate, and I really hate this Searcch button bringing up the top left corner menu. So, I decided that I will make a Caps Lock from it, but I am ...
-1
votes
1answer
80 views

How to search OpenStreetMap for tags? [closed]

How can I have e.g. all highway speed cameras displayed on the map, i.e. what is the URL syntax to search OpenStreetMap for certain tags?
0
votes
3answers
106 views

How to escape spaces in grep search results? (filenames)

When I run this: for f in $(grep -r --include=*.directory "search-string"); do echo $f; done; I get the search results split up by the spaces in the search results' filenames. How can I ...
0
votes
1answer
70 views

Search inside files with Nemo?

Is it possible to search the content of files in Linux Mint Debian Edition 4? Is this functionality implemented in Nemo or can this only be done in the terminal? If so, how? Problem: I need to find a ...
0
votes
1answer
32 views

Make man highlight matches without jumping to the match

On reading a manpage with man, searching for a keyword /keyword or, for backwards search, ?keyword and hitting enter causes the text to be briskly repositioned at the first match. When I only want ...
0
votes
0answers
19 views

how to find specific type of file that are modified within a certain range of dates

There are many questions here that seek files modified within a certain date range. How do we use linux (Ubuntu) command line to search for a certain type (e.g. *.odt) file within a certain date range?...
6
votes
1answer
201 views

less - How to get matching line not be the top line on screen?

Very often happens that I do $ man someprogram to inspect the manual for some program. Often I also want to search for something in there, and I simply hit / and write whatever I want to search for. ...
1
vote
3answers
392 views

Grep lines that match pattern twice

Usually grep outputs any lines that match a pattern. I want to be able to find lines that match the pattern multiple times. For example, if my search pattern was "foo", then: foo bar #...
2
votes
0answers
48 views

Make grep exclude a specific directory [duplicate]

The context Consider the following directory $ tree -a $(pwd) | sed "s,$HOME,~,g" ~/mytest ├── 1 │   ├── 1.txt │   └── 2 │   └── 1_2.txt └── 2 └── 2.txt 3 directories, 3 files and ...
0
votes
2answers
31 views

How to output the amount of documents per author in a directory

I am trying to count a set of documents from a text dataset by author. I have a directory of books which are named by the author followed by the title. I want to output the number of documents in the ...
1
vote
1answer
19 views

What is the most efficient way to search a block device for valid (filesystem) superblocks?

I have a block device that contains some valid filesystem (including the main and backup superblocks) at some unknown offset with some unknown block size. In my case I happen to know that it's an ext4 ...
1
vote
2answers
58 views

Is it possible to use grep or awk to report duplicate output lines corresponding to repeating entries in an index file?

I can't seem to get either grep or awk to do a relatively simple index pull of a list. I suspect it's because of adjacent duplicates in the index file, something I wouldn't have thought would cause an ...
2
votes
0answers
25 views

search and replace over multiple files, including grammatical cases, plurals etc

There is a software documentation (written in Sphinx) consisting of a significant number of files, and I want to create a glossary. This means I have a list of terms for which a glossary entry exists ...
0
votes
2answers
39 views

how to search a file for all occurances of a list in another file

Looking for advice on how to search one file for all occurances of a list in another file and output to a results file. The source file being searched is a list of short names, FQDNS (A records and ...
0
votes
2answers
51 views

How to exclude multiple folders matched by wildcards from a find search

I wish to find all files and folders except/excluding folders starting with 'tmp' and 'logs' under '/app/test' directory using prune Thus I tried the below command. find /app/test -type d \( ! -...
1
vote
1answer
70 views

Search text in files with accent characters

I would like to search for text with accents in files. I know that I can use grep for searching regular text: grep -rnw './' -e 'KORONA' ...but it doesn't work for words with accent characters, like ...
0
votes
0answers
46 views

How to check whether the names in file exists in other files in linux?

I usually check whether a specific pattern Raju exists in any of the files in a directory like below: grep -E "Raju" *.csv But, now I have a file named all.csv that was kept in directory direct ...
0
votes
1answer
62 views

Find all files with character: �

Have a massive codebase (2Gb mostly code) where valid utf8 symbols in German were replaced by this symbol: "�" Is there a way I can find all files that contain this reliably? Visual Studio Code does "...
1
vote
0answers
63 views

Search in zathura bookmarks

Is it possible to search in bookmarks and "subookmarks" created from table of contents? I need to read 1200 pages MCU datasheet and fast orientation in bookmarks is necessary. This feature is for me ...
2
votes
0answers
13 views

How to extract similar blocks of code from multiple files into a single file?

Problem: I have multiple large files that contain the following code block(s) split across all of them: type Query { ... } extend type Query { ... } extend type Query { ... } I wish to parse ...
0
votes
2answers
33 views

Find a value in a specific position when the only information you have is the position

I have a csv file approximately 16,000 rows long, with two fields. The first field contains a list of numeric values, and the second field contains a list of first and names delimited by semi-colons ...
0
votes
1answer
29 views

Find if an IP from a list is present in another list of ip

i ve been reading lots of example here and i didn t find a solution to my problem. i have been given a list of 1200 IP one per line, and i need to verify if we have a trace of any of these ip in a log ...
0
votes
3answers
67 views

Replacing comma if found inside double quotations in a CSV file using sed

I have a CSV file which I need to load to a MySQL table. I rely of identifying the columns end by the , character. That's why it is important that the , does not appear elsewhere other than as a ...
1
vote
0answers
70 views

How to use fzf to search within all lines of files (ignore newlines)?

The fzf examples wiki page describes how fzf can be used to fuzzy search within the content all the files of a directory. But in the examples from the wiki page, e.g. with ag --nobreak --nonumbers --...
-1
votes
1answer
48 views

What is the difference between grep -r and find here?

I'm trying to recursively grep through files in a directory to find a certain string. The solution of my choice is: $ find . -type f -exec grep "string to find" {} \+ ... while using grep ...
0
votes
2answers
133 views

How do I find all sqlite databases inside a bunch of files without file endings?

I have a bunch of files that have just hashes as names and no file endings. (It's an iPhone backup to be precise.) I know there are SQLite databases amongst these files. How do I find them?
2
votes
0answers
38 views

How to search for end-of-line hyphenated words in less(1)

Does less (or any other lightweight pager I could use as $PAGER) has such a feature? For example, if I type man bash and then enter /incorporates it doesn't find the word, despite it being right ...
1
vote
1answer
71 views

How to exclude/hide a directory from a command (find command or else)?

How to exclude a folder or path from a command or application in general? I am trying to exclude a path from find command but available possibilities like prune option explained here and here makes ...
1
vote
3answers
49 views

VIM: scripted search and replace?

I am switching to Linux and used to have NoteTab Pro, which allowed me to do scripted search and replaces... as I need multiple replace sequences to achieve a certain outcome. I'd like to put these ...
2
votes
1answer
44 views

Search directories containing numbers larger than a certain threshold in their name

This is the command that I have and would like to modify with an additional condition: find /home/user/backups/ -mindepth 2 -maxdepth 3 -name "*~EEEE000.tif" -print This is the output of ls /home/...
1
vote
1answer
30 views

how to grep color for “0”

Say echo 0 10 20 30 40| grep --color -E '0' I only want the first "0" to be red in color, how do I suppress the zeros from 10, 20, 30... from turning red?
0
votes
1answer
167 views

How to output specific columns separated by a special delimiter using cut

I have a file which contains several columns separated by special delimiter with multiple chracters like this: <xx>. A line will look like this: firststring<xx>11<xx>thirdstring/&...
1
vote
1answer
122 views

Vim search and replace html tags reusing hits

I want to replace html tags in vim but reuse what I found. Namely I want to replace <div class="subSectionTitle"> Title 1 </div> with <h1> Title 1 <h1> I tried to ...

1
2 3 4 5
10