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.

learn more… | top users | synonyms

1
vote
0answers
17 views

Search for the multiple string and print it to file in order [migrated]

I have a data as below, and I need to filter out the Author with "file changes and Lines Modified/Added Lines Deleted" And I need to separately print it to file with respect to Authors. If there are ...
1
vote
2answers
32 views

How to limit the number of search results per directory

How to limit the number of search results per folder, for example: With this command: grep --include=*.php -Ril '<?' '/var/www/' I get the following: /var/www/test.php /var/www/test1.php ...
1
vote
0answers
27 views

Review GREP and FIND results in Xemacs

I spend a lot of time searching code. I really like grep and find, because of all the options available. But it takes way too long to navigate the results. I use xemacs and it takes 3 more commands ...
1
vote
2answers
68 views

find field pattern in a csv file then count unique field values

I am using Cygwin (bash) to create a script to find, group and count fields in multiple CSV files. Each row will have comma-separated fields with each field following a similar convention. There is a ...
2
votes
1answer
51 views

Highlight the current search match in man pages

When I open a man page, for example man chmod and I hit / for searching a string in the page I can see all the matching strings highlighted. Pressing n or N will focus on the next/previous matching ...
2
votes
2answers
164 views

Limit grep context to N characters on line

I have to grep through some JSON files in which the line lengths exceed a few thousand characters. How can I limit grep to display context up to N characters to the left and right of the match? Any ...
1
vote
2answers
44 views

extract certain string, search and replace or keep a longer string contain the extracted value

The input file that needs to be edited is as below (can have more rows): bundle_id target_id length eff_length tot_counts uniq_counts est_counts eff_counts ambig_distr_alpha ...
1
vote
2answers
53 views

Strings not outputting text found using grep

I am looking for certain strings in (Windows) executable files. First I started with grep -a string file as that treats binary files like text files. The problem there is there is no neat output, ...
6
votes
1answer
61 views

Linux: Locating text file from a string input

I have started to use Linux and I'm practicing using/making codes to locate and do things. I need help with code that locates any file from a string of input. I don't know where to start?
2
votes
2answers
53 views

Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r ...
1
vote
0answers
33 views

Searching in man pages [duplicate]

Recently, I stumbled over some configuration files. To gather more information about its structure and how the its used, I either do a quick research on the internet (just ask Google) or use the man ...
0
votes
1answer
96 views

How do I search for files from the gnome GUI in debian?

I sometimes spend time in the standard classic gnome GUI in debian wheezy, and today I wanted to search for files containing some text in a certain folder. I tried to do it the windows way by going ...
2
votes
0answers
70 views

KMail: Search for messages with attachment

How can I search for messages with one or more attachments in KMail? The search filters don't show such an option, and when selecting "Message Status" there also isn't a criteria for attachments. ...
4
votes
2answers
365 views

Replace very long string in files recursively

I have a very long and complex string in many files and I want to remove/replace it recursively. The string contains many slashes, backslashes and spaces and any kind of special signs. How do I do ...
1
vote
2answers
52 views

search and replace string

I have a XML tag for example <tag name="abc"></tag> I wanted to replace the string inside "" with the tag name i.e the upper XML tag should be become now <abc ...
0
votes
2answers
87 views

How to count number of instance of a word starting at another word

I need to grep the MySQL-error log starting at today's date formatted like: `date +"%y%m%d"` (140710) And look for all instances of the word partitioned. I've tried various things to no avail. ...
3
votes
2answers
1k views

Find and replace different columns using awk

I try to make a change in a file: Find a certain value and substitute it with another value in a different column using awk. Input (UiO-66Zr-EH.mof): unit ntype qqatom 1 'Zr1' 0.0d0 vibration ...
0
votes
1answer
136 views

How to copy contents of command line search result in unix to a file?

I would like to accomplish the following. Copy the contents of all search results into a single file. I don't want to copy the search result but the file contents of the search result. For example ...
2
votes
3answers
869 views

searching multiple strings in multiple files inside a directory and printing the string and corresponding file name where it was found

I have around 500 strings and I want to search for the files which contain them inside a directory and get the file names which contain the strings. So far I've been using: find -name 'LYFNRE.*' ...
11
votes
3answers
287 views

Search for man pages which contain ALL of the words 'foo' 'bar' and 'baz'

I'd like to search for man pages which contain ALL of the words 'foo', 'bar' and 'baz'. If possible, I'd like to search through all text (not just name & description) of all man pages. I'm ...
2
votes
1answer
55 views

updatedb for a beginner

The updatedb command, as I understand it, is basically the utility that keeps the mlocate.db database file updated. And it's a good idea to keep it updated regularly. For that matter, I've kept a ...
1
vote
1answer
18 views

Can't search for flags in qalter's man page?

I was trying to find out what qalter's -r flag does, but I can't search for -r when viewing the man page for it (pattern not found). Yet it's clearly there. If you scroll down a bit you'll see it. Why ...
2
votes
1answer
48 views

Exiting a '&pattern' search in less

After using a search in less of the format &pattern, which displays only matching lines, how can I go back to displaying all lines in the file? Esc doesn't do anything as far as I can tell. ^C ...
14
votes
1answer
312 views

Is there a way to search manpages for typical use scenario?

I have a relatively small brain, so there is a limit to what I can store up there. I have been using Linux semi-pro-amateur for a few years and still I am amazed at how little commands I know. Simple ...
0
votes
4answers
421 views

Search for a Value only in one column w.o using awk, sed, or perl

I have a file that looks like this : Marketing Ranjit Singh FULLEagles Dean Johnson Marketing Ken Whillans FULLEagles Karen Thompson Sales Peter RobertsonPARTGolden ...
4
votes
1answer
115 views

Highlighting text in bash when using reverse history search using Ctrl-R

Using Ctrl-R, I can search the history in bash. But what to do, If I want to highlight the relevant word which has been typed upon by me. Example: (reverse-i-search)`mount': sudo mount /dev/sda2 ...
1
vote
7answers
2k views

Can grep be used for searching files with some string in their names?

I understand that grep can only be used for searching for files which contain a string in their content. Can it be used for searching for files with a string in their names? I read the manpage, and ...
1
vote
1answer
236 views

'ipkg search xxx' always returns no answer

On a Synology NAS (uses a 'home grown' *nix variant (possibly based on Debian?)) I have installed ipkg package manager. When I try a command like ipkg search shred or ipkg search *shred* it ...
2
votes
2answers
1k views

How to search and replace strings matching a replacement list for multiple files

I have a file, say map.txt, containing a list of search strings and corresponding replacements: search -> replacement bigBone -> bb fishMarket -> fm dogCollar -> dc ... I need to ...
7
votes
3answers
119 views

Can I force `man` to do lower case sensitive matching?

When I search man pages, the search is case sensitive, but only with regard to upper case letters. E.g., x will match x and X whereas X only matches x. This is the man-db version of man, used on ...
0
votes
1answer
133 views

Highlight patterns in command output (grep-like but without excluding lines) [duplicate]

I need a command that colorizes some symbol sequence in output of a certain command. I'd like it like grep make it. $ some-command | grep symbol-sequence However grep removed lines that isn't ...
2
votes
1answer
657 views

Find font file from font name on Linux

I have a font with the name Media Gothic. How can I find the file name of that font in Linux? I need to copy that file to another system. I've tried: find /usr/share/fonts/ -name '*media*' But this ...
1
vote
1answer
134 views

How to copy access.log lines by time?

I have a huge webserver access.log in CentOS. I access it over remote VPN so I cant copy the file or read it directly. I know the specific time in the logs I want to copy, but it is too far back too ...
1
vote
1answer
353 views

Can we make grep faster by indexing words in files? [duplicate]

Over a decade ago I imagined an improved version of grep that would use indexes to make recursive searching faster. I never got around to writing it, but I wonder if somebody else did! My original ...
3
votes
4answers
4k views

Compare two text files and find matching lines

I have two files A and B. A looks like this (4 to 6 lines): GAGA CAGA GGGT TATT file B is a really big file with thousands of lines, here is a short example: AAATGTCAAGAGACAGAAATGTCAAGAGGGT ...
2
votes
2answers
33 views

Search for files by content only in trunk subdirectories

I think its a simple question, but the answer is probably a little more complicated :P Edit: Actually, its not complicated at all!^^ So I have a directory with multiple svn projects and I would like ...
0
votes
1answer
111 views

Lynx incremental search

I am trying to run an incremental search using lynx. Imagine a page, for example, an index_of page which contains several folders which also contain other subfolders and files. I want to run lynx in ...
3
votes
1answer
104 views

What does the search flag 'z' do in VIM?

I was looking for a way to show a bit of context around my searches when doing g/mysearchtext/p When I stumbled across this page Search-a-pattern-and-provide-a-context-few-lines-above-and-below ...
8
votes
2answers
486 views

Is there a command reverse search in vim?

In linux cli I can do ctrl-r and do a reverse search and choose something I have done easily. Is there something similar in vim? I mean I may run a command using : (could be anything like a long ...
18
votes
3answers
2k views

Unix command to check if any two lines in a file are same?

Is there a unix command that can check if any two lines in a file are the same? For e.g. Consider a file sentences.txt This is sentence X This is sentence Y This is sentence Z This is sentence X ...
11
votes
4answers
11k views

How can I “grep” patterns across multiple lines?

It seems I am misusing grep/egrep. I was trying to search for strings in multiple line and could not find a match while I know that what I'm looking for should match. Originally I thought that my ...
1
vote
2answers
74 views

Searching for packages using apt-get

I'd like to search for repository packages using package name or package description. For example Search for Zend Search for Ze*d
1
vote
2answers
93 views

Mailing out a customised content based on specific search in a logfile

Using below test.sh, I am getting result in dump.txt as below: test.sh: #!/bin/bash #"Maxl-script" zone starts..... essmsh -l admin password -s localhost -i << EOF spool on to 'dump.txt'; ...
1
vote
2answers
52 views

How to search for available software in repositories though CLI?

I want to be able to search all available software like one would using "Synaptic Package manager" or "Ubuntu Software Center" through Command Line.` I want a better way than pressing Tab after ...
3
votes
1answer
129 views

Search Alt+F2 history in Cinnamon desktop environment

I wonder if there's some way to search the Alt+F2 "runner" history most preferably within the dialog itself. I know that in Cinnamon the values are available in dconf-editor under org.cinnamon ...
5
votes
5answers
877 views

How to search in specific files matching a pattern

How can I find a word in specific files matching a pattern. e.g. searching for version in CMake* files recursively found in the current directory.
2
votes
2answers
1k views

How to show only installed packages by executing “aptitude search”?

After executing the aptitude search pattern command, I need to see only installed packages in the search result. Is there any way to do that?
4
votes
2answers
869 views

Case insensitive search in man pages

Is there a way to search man pages case-insensitively? Using the '/' search feature matches exact case.
0
votes
1answer
134 views

How can I pass in a parameter to sed?

To be more precise - how can I pass in a parameter to a program that then calls sed - how can I 'pass' that parameter along? I have a file 'source_code.sc'. I have a sed script "find_expect": #n ...
15
votes
2answers
297 views

Open man page and search for string in a single command

Instead of doing man chmod and then /a+x to jump to the first section in the chmod man page that mentions a+x, I would like to know if there is a way to open the man page to a specific search string, ...