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
1answer
16 views

Phrase search in recoll

I would like to know whether I could avoid Recoll searching uses of any of the words in a term and only search the exact term. For example I'm trying to search for register indirect and it gives ...
0
votes
2answers
24 views

Get or filter duplicated lines by column

I have a file with three columns and I would like to get duplicated lines by third column, for example: AAA = 342 BLABLABLA = 2 BBBx2 = 23 1+1 = 2 KOKOKO= 5 2x1 = 2 The output sould ...
5
votes
2answers
86 views

How to search for text in a file ignoring newlines?

I'd like to search for text that may be split over several lines in a file. A grep that would ignore line breaks and return the matching span of lines. e.g. I would be searching for is an example ...
1
vote
2answers
50 views

How to show searched lines as well as number of occurrence of searched string?

I am working on a script which will show all the results and their count on the console based on a particular string . Example: Suppose I searched for a string called "ERROR", I got the below ...
1
vote
0answers
16 views

tool in terminal like helm-occur/helm-swoop for terminal?

I don't know whether this is the right place to post this question, but if you are not an Emacs user, I'll explain the basic usage of helm-occur/helm-swoop. I like helm-occur/helm-swoop for Emacs ...
-1
votes
2answers
32 views

Extracting certain data within a script output file

We have a script that runs several commands and rolls up all the output and inserts in into a log file. One of the commands it runs is "netstat -anp". I'd like to be able to search this file for all ...
1
vote
2answers
140 views

How would I use sed or awk to extract certain lines in a file

If I wanted to search for all lines in a file that start with a date, such as "May 1", how would I do that with sed or awk? I need to extract this data and either send to screen or a file. Thanks.
1
vote
1answer
33 views

How to filter a basic csv by columns

How do I filter by third column of the following file list.txt [[ list of people ]] billy baxter - @baxter - b.baxter@woods.com james woods - @woods - j.woods@someother.com I currently have cat ...
0
votes
1answer
53 views

No highlighted selection in Slingshot (Elementary OS Freya)

After logging in, when I invoke Slingshot search for the first time the highlight is there -- and it is very useful when scrolling up and down. But after that it is absent. In all cases except ...
1
vote
2answers
46 views

How do I get a count of file references inside a folder of files with those references?

Alright, I have two folders. For simplicity's sake, I'll call them people and animals. The animals folder has a file for each animal, and the people folder has a file for each person with references ...
0
votes
1answer
45 views

Search and replacing strings in a numerical data file

I have a data file I need to edit it is in the form: ...
4
votes
1answer
83 views

How to tell “grep -w” what characters make up “words”?

$ printf 'asf .test. afd\nasaf foo-test asfdads\n' asf .test. afd asaf foo-test asfdads $ printf 'asf .test. afd\nasaf foo-test asfdads\n' | grep -w test asf .test. afd asaf foo-test asfdads ...
4
votes
1answer
46 views

Find the files between two folder dates in linux?

I need to find the folder names along with the file names which has my string in their contents. I am in this directory "/data/queue/data" and I have lot of folders in the same directory and inside ...
2
votes
3answers
98 views

How to search the whole manual pages on Linux?

Sometimes I need to look up certain words through all the manual pages. I am aware of apropos, but if I understand its manual right, it restricts search to the descriptions only. Each manual page ...
1
vote
4answers
79 views

Is there a way to grep a folder and show all lines containing non-ascii characters?

Some code I am working with has a bunch of comments written in Japanese and I am working on translating them to English. Is there some way to "grep" for all lines containing Japanese characters or at ...
1
vote
1answer
46 views

Modify Gnome 3 search bar results

Is it possible somehow modify results of default search bar in Gnome 3? I'm currently having a little problem with launching calculator app. I always pressed Super and typed "calc" and enter. But ...
0
votes
6answers
65 views

How can I use grep to search only on the first line of files for a specific string?

How can I use grep to find a string in files, but only search in the first line of these files?
0
votes
2answers
62 views

Search a line and replace line

false###File.txt many rows ###online = false --> ONE SHOT import (delete all table contents before importing) ###online = true --> DIFFERENTIAL import (import without clean the table contents) ...
3
votes
2answers
55 views

less: /pattern search starts at first line

Consider the following file: $ LESS= \less test abc def abc By default, searching /abc in less will jump to line 3 since /pattern search starts at second line according to man 1 less: /pattern ...
6
votes
6answers
2k views

How do I grep recursively through .gz files?

I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file. ...
0
votes
1answer
64 views

Space removal after a pattern in SED

I have a file instrument.xml bash-4.1$ more instrument.xml <instr instr_id="CPT-2380950-011-001-826" valor_ch="" instr_type="CurrentAccount" instr_name="CPT-2380950-011-001-826" qn_type="1" ...
3
votes
2answers
95 views

Select added lines from file

I have two versions of a file where the newer one has some lines added. The files are sorted (think of wordlists) and I want to print out the newly added lines (given file1 and file2). I know how to ...
2
votes
1answer
40 views

Is it possible to make VIM emphasize found text?

As vim wiki's stated we can look up strings by using *. But by default, looked up string is not being emphasized. Is it possible to configure vim that the strings will be emphasized when looked up ...
2
votes
2answers
64 views

How to search many files with regular expression and output matches to lines in a new file?

I have 1000's of source files and I would like to find all text that matches a regular expression and then output each match on its own line in a resulting text file. For instance; // a.cs string ...
-1
votes
1answer
59 views

How can I recursively grep through several directories at once?

I use grep -r all the time to find occurrences of a string within files in a given directory: $ grep -r "string" app/assets/javascripts > app/assets/javascripts/my_file.js: this line contains my ...
1
vote
2answers
28 views

Where is pithos installed?

I'm trying to find the installation directory in Pithos so I can hack it, and am really bad a unix commands and am embarrassed to ask this. If I do: `which pithos` This returns a link to the ...
1
vote
1answer
113 views

Searching file based on data range

I previously posted requesting help with counting occurrences of a string. I'm now hoping to search for the occurrence of a string within a range of values and print out a similarly formatted file ...
2
votes
2answers
73 views

Search and Replace question

I need to find all occurrences of AAsomeArbitraryStringBB and replace it with CCsomeArbitraryStringDD. So AAHelloBB Text AAByeByeBB becomes CCHelloDD Text CCByeByeDD. It's important to note ...
0
votes
1answer
41 views

For value falls within a range get corresponding value

I am thinking to use awk to search a value from input file in a reference file and get a corresponding value from reference file. Both reference and input files can be sorted based on $3 and $2 ...
1
vote
1answer
23 views

How to disable mail search in tracker-needle?

I wish to search only my local folders. Everything was ok, until I installed thunderbird and downloaded mail. Now searches take too much time, because tracker searches the mail to. Where in the ...
1
vote
2answers
91 views

How do you search and replace multiple lines in KDE Kate?

how do you replace multiple lines of code in Kate? The following is the original text: <div id="image"> <br style="clear: left"/> <br style="clear: left"/> <br style="clear: ...
5
votes
3answers
227 views

grep for multiple regexes, and count the number of occurences

Say, I have a file, and multiple regexes have to be searched in it and the number of matches for each regex has to be counted. Thus, I cannot combine the patterns: grep -Po ...
0
votes
1answer
104 views

how to find file defining an alias

I am having a problem I'm not sure how to get around. Somehwhere on my system, I have an alias defined as such: alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\' I ...
4
votes
2answers
121 views

Error getting the string between two patterns

I want to get a string between two patterns. The pattern is the first environment <p> </p> in an html file. <p>Sorcery, R (1) </p> <p ...
5
votes
3answers
98 views

Find latest copy of same file in folder structure

I need to get the path of foo.txt in a folder structure. There are multiple foo.txt files in this structure but I need an automated to find the latest. Suggestions?
1
vote
2answers
47 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
33 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
240 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
243 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 ...
4
votes
2answers
1k 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
74 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
74 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
135 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
86 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
34 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
255 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
110 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
624 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
73 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
102 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. ...