Questions tagged [grep]

-1 votes
1 replies
grep won't stop sending data to a string
I have a very simple script that scans a file for a string and if it finds it, it sends that string to a file. My problem is that the command loo...
asked 1 month ago
0 votes
3 replies
Extract lines with string and variable number pattern
I have a big file with many lines starting like this: 22 16052167 rs375684679 A AAAAC . PASS DR2=0.02;AF=0.4728;IMP GT:DS In these lines, DR2v...
asked 1 month ago
-2 votes
2 replies
RegEx for matching a multiline pattern containing Phrases A and C but not B [closed]
I want a regex that finds all matches for "cat" when "1234" precedes it and "he" does not. E.g., in the following blob of text, the first 2 group...
asked 1 month ago
0 votes
1 replies
grep out url from html files and pick top one somehow
I have a many (think 17,000) html files that contain links. Each html file can contain many links but they all reference the same video mp4 but i...
asked 1 month ago
-1 votes
0 replies
How to parse string to extract dot from it in gerp with PCRE [duplicate]
What is the difference between: (.+?) and (.*?) when I use it in my php preg_match regex? 69 9 Answers 9...
asked 1 month ago
-1 votes
4 replies
Combining Grep and Paste command in bash
very sorry to ask a stupid question but I'm getting crazy with this thing. So, I'm in bash and I have some files: ls a.bed b.bed c.bed all...
asked 1 month ago
0 votes
5 replies
How to grep repeated strings on a single line?
I have this a file.txt with one line, whose content is /app/jdk/java/bin/java -server -Xms3g -Xmx3g -XX:MaxPermSize=256m -Dweblogic.Name=O2pPod...
asked 1 month ago
1 votes
2 replies
Grep - Getting the character position in the line of each occurrence
According to the manual, the option -b can give the byte offset of a given occurence, but it seems to start from the beginning of the parsed cont...
asked 1 month ago
0 votes
1 replies
Finding word permutations in text
I am trying to find words for a text file that have the same number of characters but are in a different order. For example. I input a word like...
asked 1 month ago
0 votes
2 replies
How to obtain contents of multiple HTML tags using grep?
I am trying to return the song name and artist from a webpage using a bash script. After consulting some SO posts, I put together: #!/bin/sh m...
asked 1 month ago
0 votes
1 replies
Select files reading names from a text file
I have a directory of files. I want to select some of them based on a text file I have. The text file has partial names of the files which I need...
asked 1 month ago
-1 votes
1 replies
How do I retrieve all files in linux for given directory level. I want to absolute path aswell as the filename
I'm trying to retrieve all files for a given directory level. The files retrieved should also show absolute path. git ls-files | cut -f1 | uniq...
asked 1 month ago
-1 votes
1 replies
How to ignore grep if the line starts with # or ;
Need to ignore grep if the line starts with ; or # for a specific string in a file. file.ini contains below line output_partition_key=FILE_CREAT...
asked 1 month ago
1 votes
3 replies
How to use grep/awk/sed to isolate part of a file between delimiters, potentially crossing lines
I am trying to obtain a specific part of an output file using a bash script, but I don't know how to proceed. First of all, the data I need are b...
asked 1 month ago
-1 votes
0 replies
grep two unordered strings with logical AND [duplicate]
I am trying to use grep to match lines that contain two different strings. I have tried the following but this matches lines that contain either...
asked 2 months ago
-1 votes
4 replies
Bash grep JSON Response
Here is the JSON Response in a File, namely, RGLogin.json {"response":{"session_id":"2d48cc11ceabf28c9e92f4b677337dcd"},"response_status":200,"r...
asked 2 months ago
-2 votes
7 replies
Get only numbers in output
I need to get only numbers from this: release/M_0.1.0 thus, need to extract with bash to have in output this: 0.1.0. I have tried this but canno...
asked 2 months ago
-2 votes
2 replies
Using sed or grep to search and replace ip address in the file
I have used this code it only enter with new ipaddress sed -r 's/(\b[0-9]{1,3}.){3}[0-9]{1,3}\b'/$newip/ But i need to enter with system ipadd...
asked 2 months ago
0 votes
2 replies
Makefile should bail out if a target fails
I have a makefile of the following format - all: target_1 target_2 target_3 target_1: TASK_A1 | tee ta.log TASK_A2 | tee -a ta.log ta...
asked 2 months ago
0 votes
3 replies
Extract the line in a file if the second column matches a certain value
I have a file and i want to print the entire line in a file if the second column matches a particular value in the file My file contents are...
asked 2 months ago
2 votes
3 replies
Extract number with special characters from a file using sed and grep command
I am trying to extract the number surrounded by the square brackets after matching with the word that is placed after the number. for ex. The fi...
asked 2 months ago
-3 votes
1 replies
Need help matching a pattern using egrep in bash scripting [ SED/GREP] [duplicate]
This question already has an answer here: Need help matching a mattern using grep/egrep in bash scripting...
asked 2 months ago
-1 votes
0 replies
finding a string in file name ( message_1.html ) located in multi folders
I'm trying to search for a string ( Arabic string ) .. in the file name (message_1.html ) this file in multi Dir in my HDD, the string is ( تقري...
asked 2 months ago
0 votes
8 replies
How to extract codes using the grep command?
I have a file with below input lines. John|1|R|Category is not found for local configuration/code/123.NNN and customer 113 TOM|2|R|Category is n...
asked 2 months ago
0 votes
5 replies
how to make grep ignore first line and process other line
I need to remove line beginning with '#' in some txt file. but ignoring the first line as it header. how to make grep ignore first lines and remo...
asked 2 months ago