Skip to main content

All Questions

Tagged with
2 votes
2 answers
63 views

Listing a certain part of filenames and their contents

I have a Linux machine with BusyBox, which has a directory called /data/var/lib/connman.  That directory holds some directories that I'm not interested in.  But it contains many .config files that ...
Norbert's user avatar
  • 121
3 votes
3 answers
730 views

Find files matching one pattern, but not another, using grep, awk or sed [duplicate]

I need to locate .php and .pl files that do not contain one string (e.g. aaa), but do contain another (e.g. bbb). I'm currently using this command: find /path/ \( -iname '*.php*' -or -name '*.pl*' \) -...
Krackout's user avatar
  • 2,742
0 votes
1 answer
120 views

Find the highest number after specific string from mutiple files

Each file has similar content: number 1: asdfa11sdfsadf number 2: asdfa12sdfsadf number 1: asdfa1sdfsadf number 3: asdfa33sdfsadf return 3 or number 3: are equally good. Have tried: max="$( awk ...
Maxfield's user avatar
  • 161
3 votes
5 answers
2k views

Recursive grep matching only specific line number

How can I can I find files that contain a specific pattern on a specific line number ? Let's assume I have a directory with a bunch of text files containing 3 lines, such as: Title A Category X ...
Pierre-Jean's user avatar
  • 2,259
1 vote
2 answers
5k views

Using find + grep + awk in combination

I'd need to filter through a list files (output of top command) for some info: Firstly I need to list files with a find Then, I need to grep for lines with a pattern Finally, I need to pickup one ...
Francesco Marchioni's user avatar
1 vote
1 answer
84 views

Find text files that have 2 terms in them (in any order, at any line) [duplicate]

I have been looking at grep -e where you are doing an "and" operation which is the sort of thing I want. However, if I get it right, the two terms have to be in the same line to be returned. What I ...
demongolem's user avatar
1 vote
1 answer
210 views

Using awk, find or grep for svn export

I am trying to download only some files with the name "battery", using svn export: svn export https://github.com/zayronxio/Mojave-CT/trunk/panel/24 | awk "battery" svn export https://github.com/...
Oo'-'s user avatar
  • 243
1 vote
0 answers
58 views

Get entire paragraph by searching single word or multiple

I need your help in scripting portion. I have a configuration file for routers as below, # TiMOS-C-16.0.R5-1 cpm/hops64 Nokia 7750 SR Copyright (c) 2000-2019 Nokia. # All rights reserved. All use ...
riswan66's user avatar
1 vote
2 answers
2k views

Find text with wildcard [closed]

I am looking in a /etc/hosts file for hosts that should contain servers that look at least like this: mobile.example.com more.mobile.example.com and NOT example.com I want to search with a wildcard ...
superbyte's user avatar
0 votes
2 answers
713 views

Find files (not) containing text pattern on a specified line

I'm trying to search through a set of text files and return the names of files that on a specified line contain a text pattern OR do not contain the text on the specified. In my case I need to return ...
youngfu's user avatar
3 votes
4 answers
191 views

Search recursive for files that contains a specific combination of strings on the first line

I need to find all files that cointains in the first line the strings: "StockID" and "SellPrice". Here is are some exemples of files : 1.csv : StockID Dept Cat2 Cat4 Cat5 Cat6 Cat1 ...
Jonson's user avatar
  • 33
-1 votes
2 answers
973 views

Recursively find ONLY the latest logs in all sub-folders and save to file

I am working on a RHEL7 box. I need to recursively find all the LATEST (and only the latest) .log files in each sub-folder below a certain hierarchy and list their full paths in a file 'all_logs.txt'...
SSDdude's user avatar
  • 171
0 votes
1 answer
241 views

Using 'find' then searching each line for two values in bash script

Hello all I have a slew of files I search through with 'find' recursively then once all those file types are found I want to remove all records not matching this string on each line, in this order: ...
SSDdude's user avatar
  • 171
0 votes
1 answer
149 views

Negative search in find/grep pipeline not removing any records

I am struggling a bit with my bash find command. The problem is a late requirement which wants me to strip off all records from *.app files containing *.appstrng" This is my original find pipeline ...
SSDdude's user avatar
  • 171
-2 votes
1 answer
2k views

Grep a word in the file and then search backward for a pattern [closed]

I have a file in which I have to search for a word and as soon as I find that word , I have to keep that record in my output and also I need to go back from that record and take a previous record as ...
Sumit C's user avatar
  • 11

15 30 50 per page