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
0 votes
1 answer
45 views

Where does "apt list" search?

apt list can list all packages available, does apt search in some database or file in some directory? apt list --installed can list all installed packages, where does apt search then?
user avatar
  • 35
1 vote
0 answers
26 views

How to find the PHP file which prints an HTML element with a certain selector?

I store my MediaWiki 1.36.1 website with Skin:Timeless on NameCheap with a shared hosting environment with Cpanel file manager and SSH shell access. In my website, there is a certain footer element ...
user avatar
-1 votes
1 answer
44 views

Search & replace for a string separated by whitespace upon substring match found

Below is a sample file content: cat sample.txt -server -XX:+UseParallelGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+AggressiveHeap -XX:+PrintHeapAtGC -Djava.util.logging.FileHandler....
user avatar
  • 297
0 votes
0 answers
33 views

Linux command for searching a log

I’m trying to search an Apache log for a specific error, displaying the lines descending with counts. What would be the best way to accomplish this?
user avatar
  • 1
0 votes
2 answers
45 views

How can I see the line number of a searched text?

Suppose, I have a text file named output.txt which contains 1.46 million rows of data. I want to search a text 27QL in the file. If the text exists, Linux should return the line number. How can I do ...
user avatar
0 votes
0 answers
101 views

Searching strings in raw disk image

I am currently writing a tool that should scan a readonly raw disk image for a a given pattern. The task is to get the byte offset of the match. I am able to find simple text documents with grep -a -o ...
user avatar
0 votes
3 answers
76 views

Search and Remove Lines of Code from all files

I need help and need to search for and remove a 3 line bit of code from all files in a directory. Code is: if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) )...
user avatar
0 votes
1 answer
35 views

Why is this mv command trying to write to a directory?

I'm using this search and replace string; find . -name 'xna*jpg' -exec bash -c ' mv $0 ${0/\ (2018_05_28 14_04_27 UTC)/}' {} \; So that it will replace "xna (2018_05_28 14_04_27 UTC).jpg" ...
user avatar
2 votes
3 answers
210 views

Replace dynamic word using sed command

I have a requirement where we need to replace a word in a file which can be different everytime I execute the script, the content of the file is class DynamicContentToReplace > Something Here I ...
user avatar
0 votes
1 answer
28 views

How do I configure ag so that it will also search for files beginning with a "."?

I'm using ag v 2.2. How do I configure ag so that it will search for files beginning with a "." in addition to all other files? I'm noticing I have a file like so $ cat client/.env....
user avatar
  • 1,810
1 vote
2 answers
59 views

How to have "apt search" give one-line summaries?

apt-cache gives one line summaries: $ apt-cache search conway golly - Game of Life simulator using hashlife algorithm libclass-delegator-perl - Perl module for a simple and fast object-oriented ...
user avatar
  • 21
4 votes
2 answers
472 views

Search PDF files with more than 100 pages and moving them into directory in UNIX/LINUX terminal

I'm trying to search for PDF files that have more than 100 pages and then moving them into a specific directory in the UNIX/LINUX terminal. Something a bit like this: find . -name '*.pdf' -pagenumber&...
user avatar
  • 143
4 votes
1 answer
152 views

Using anchor ^ pattern when using less / search command

When navigating through Linux man pages, sometimes you need to query the meaning of flags like -p or -al in the man pages. The default text reader for man pages is less and I'm trying to use the / ...
user avatar
  • 199
0 votes
1 answer
103 views

How can I make pacman search look better?

Currently I am using Arch. Pacman is a great package manager but can I make pacman search look better (pacman -Ss). For example if I search for a package it gives me result lik this: extra/foomatic-db-...
user avatar
0 votes
1 answer
166 views

Is there a way to search in only properties file when using grep?

I am normally searching like this grep -rnws '/path/to/directory/' -e 'JMSAppender' However this does display all jar files and class files where it might be used. I need to check only inside log4j ...
user avatar
0 votes
1 answer
37 views

Search for all videos created on a Saturday

I am using Linux Mint. There are several years worth of files and folders scattered everywhere. My goal is to find a way to search my entire hard drive for any video files that were created on a ...
user avatar
0 votes
1 answer
31 views

Is it possible to integrate pdfgrep into nemo search?

I often find myself looking for PDF documents. Luckily, I found pdfgrep that really does a great job at finding PDF documents by content. Following command lets me search for documents that have my ...
user avatar
6 votes
3 answers
592 views

Finding duplicate files with same filename AND exact same size

I have a huge songs folder with a messy structure and files duplicated in multiple folders. I need a recommendation for a tool or a script that can find and remove duplicates with simple two matches: ...
user avatar
3 votes
2 answers
341 views

How to search for a string in a very large file with very long lines?

It turns out I was accidentally using grep wrong yesterday. I just checked my bash history and saw what I was executing: grep search-string-here -f large-file-with-long-lines.txt And that was what ...
user avatar
0 votes
1 answer
33 views

Search for specific part of a line

I want to have this script which will store users in the format:<$AccountName> <$DOB> <$Username><$Password> <$Email> on a file called Register.txt. I want to have it ...
user avatar
  • 1
0 votes
2 answers
41 views

Search with less

In the output of wget --help I would like to quickly go to the place where the --header option is explained. I try searching with less. man less explains: /pattern Search forward in ...
user avatar
  • 861
-1 votes
2 answers
52 views

Checking files for a string using a loop

I'm trying to loop through files in a directory that start with the string stated in the for statement. Within the loop, I want to search for the pattern string foo within the file. If the string is ...
user avatar
0 votes
4 answers
1k views

How to loop through all files in the current and sub directories to find a string? [closed]

Hi I am trying to loop through a directory and all its subdirectories to find the string 'foo' in all the files, for example. I then want to display the file names (including full path) of all files ...
user avatar
2 votes
1 answer
175 views

How to add closing XML tags with sed

I have the following example in the XML doc: <meta name=Originator content="text/html; charset=iso-8859-6"> <meta name=ProgId content=Word.Document> <meta name=Generator ...
user avatar
  • 211
2 votes
1 answer
43 views

Which viewer can search within a line?

I have a file (a minified Javascript file) that is essentially one long line. When I run a search in this file with mc (by pressing F7 in the builtin viewer) or with less (by typing a slash) ...
user avatar
  • 930
-1 votes
4 answers
109 views

How to replace a part of the word using sed command

I have a file with just one word in each line. I want to delete some part of the word in each line. How can I delete that part using sed command? Ex: u_fox/u_snake/u_snail/u_plus/u_core/u_vector/...
user avatar
  • 1
0 votes
1 answer
153 views

VIM Search and Replace to Correct Broken Line Breaks

I have a file that I am busy trying to correct that has some dodgy Line Breaks inside of it, this is a small example Row ('Row 01') Property ('Property 01') Row ('Row 02') Property ('Property 02') Row ...
user avatar
1 vote
0 answers
36 views

In Less, how to jump horizontally between search matches on the same line?

On pressing n, Less skips all the search matches in the current line and moves to the next line with a match (even if the lines are wrapped). How can I make it move the cursor to all the matches in ...
user avatar
1 vote
1 answer
38 views

Full-text search for manpages and get the list of the name and descriptions from a console like apropos(1)

Is there any way to do a full-text search for manpages and get the list of the name and descriptions of relevant manpages from a console like apropos(1)? You can full-text search the content of ...
user avatar
1 vote
2 answers
89 views

Complicated search and replace in Vim or Sed

I have the following (yanked from my register to retain formatting, as it's probably the reason I'm here): <li><span>Concrete Patching (</span><span style="overflow: ...
user avatar
  • 21
0 votes
1 answer
31 views

Targeting large files

Often I am surprised by my disk getting stuffed, and wonder if there's a nice utility to report all files/dirs that occupy more than a given amount of space. I hope duplicates are removed as well, so ...
user avatar
  • 351
9 votes
3 answers
484 views

How to search for multiline text files containing a set of words (e.g., AAA & (BBB | CCC) & ~DD)?

I need to find the files that fulfill relatively complex condition. For example, I want to find all files that fulfill all below conditions: does contain word AAAA does contain word BBB or CCCCC (may ...
user avatar
  • 333
0 votes
2 answers
63 views

Search through on Linux files and filter out specific string and remove everything else

I am trying to find an efficient way of searching through a whole set of files in a directory and only looking for a specific string up to the first comma. Example of the postgres log file: Apr 27 03:...
user avatar
0 votes
0 answers
38 views

Fetching cookie information

Here is my problem I need to convert a Rest Api call to curl and for that Cookie is an mandatory request Header. But the problem is that cookie get expired after 4-5 hours. Is there any way to keep ...
user avatar
0 votes
1 answer
126 views

What Linux application can read PDX files?

I use openSUSE LEAP 15.2 with a KDE desktop, and I want to download some collections of PDF files that include an index (IDX and PDX files) for each collection. I'd like to be able to search and view ...
user avatar
  • 111
0 votes
1 answer
63 views

How to implement search similar to 'apt search' in bash

I'm writing a bash script that is a "package manager" that uses pi-apps. I want to implement a search function so I can search apps. right now what I'm doing is this (template is a folder I ...
user avatar
1 vote
2 answers
291 views

Log Files - A command to search for gaps of over 2 minutes in logs

Wondering if someone can help with a query I have re: log files? I am looking to run a command that will search through a log file and look for sections of that log file where there are no updates for ...
user avatar
  • 11
0 votes
2 answers
100 views

Recursively search for files that duplicate the same first 8 letters [closed]

I have folders with many files that all start with a date - 20200403 for example. I want to find which folders have multiple files with that same date i.e. the first 8 letters are the same. Only in ...
user avatar
  • 11
0 votes
1 answer
57 views

fdfind command need guidance, please?

find command makes me go crazy! Q1. Is there reason for me to still use it after i realized how easy fdfind command is ? $ fd find1 find2 ./folder Apparantly this fd command does not work as i like. ...
user avatar
1 vote
3 answers
377 views

How to extract certain columns with AWK from one CSV file to another?

I have a very big CSV log file that contains fields like this: aaa=somedata1,bbb=somedata2,ccc=somedata3,eee=somedata5,hhh=somedata8 aaa=somedata1,ddd=somedata4,fff=somedata6,hhh=somedata8 aaa=...
user avatar
0 votes
2 answers
51 views

awk paragraph with string and the following paragraph in pgn chess games

How can I get a paragraph with the string and the following paragraph with awk? The file looks like this: [Event "Chess game"] [Date "2021.01.08"] [White "Player A"] [...
user avatar
  • 218
0 votes
1 answer
45 views

replace string from left to right in a line

I want to search and replace the negative values with the value just before it. The values are separated by comma. Example: ocv_sigma_cell_rise(table_7) { sigma_type : early_and_late; values(&...
user avatar
1 vote
1 answer
244 views

Alternative to ls | grep [duplicate]

I'm trying to search through the files and directories of a specific folder. For example, I was looking in /usr/bin for my python binaries. To do so, I used ls | grep python. When I did this, I was ...
user avatar
  • 155
3 votes
1 answer
39 views

grep displaying also results which are 1 character off?

I often have a typo in my grep searches, especially when it comes to long names. So for instance, grep "super_duper_utralong_name" *txt would normally not contain super_duper_ultralong_name ...
user avatar
  • 49
1 vote
1 answer
41 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 ...
user avatar
  • 13
0 votes
1 answer
158 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&...
user avatar
0 votes
1 answer
144 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 │   ├── ./...
user avatar
0 votes
2 answers
89 views

how to search through a public email archive?

Email lists keep their emails in archives. Sometimes I want to search through those archive but I don't know how to do it. Of course I can open it one by one (actually month by month) and search the ...
user avatar
  • 269
3 votes
1 answer
52 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 ...
user avatar
  • 138
1 vote
2 answers
416 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....
user avatar

1
2 3 4 5
11