Skip to content
Advertisement

Tag: grep

Replace very near word to a number with another word [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 years ago. Improve this question Replace very near string to a number with another string How to replace

Using grep and * to get the exact file name

I have following heapdump files now if I use I get following output But I use I get no output. Could anybody help where is my mistake and how to search the heapdump files. My expected output is should give me due to some reason I could not use Answer It looks like you’re confusing glob patterns with regular expressions,

grep multipe wildcards in string

Say I have a file that contains: I want to grep and match lines that only contain ‘package’, ‘el6’, and ‘x86_64’ How would I go about doing that on a one liner using grep? The line must match all three and grep shouldn’t care about how many characters are in between. If there is a better tool for the job,

How can I extract the text portion of a binary file in Linux/Bash?

I have a binary file. If I open it with vi, it shows sequences of human-readable text and binary characters. What is the best way to extract the human-readable portion only using Bash? I was thinking, maybe we can do this over a grep or sed pattern? Answer Use the strings utility – that’s exactly what it’s designed for.

partial merging 2 text file in linux

I have 2 text file which I want to merge them in a new file. my first file is look like and second file = and my expected output like, I mean mapping part of 9th column string from first line with 1st column of second file, should be like : Also, I wanted to keep line from first file

Compare columns from two files and print not match

I want to compare the first 4 columns of file1 and file2. I want to print all lines from file1 + the lines from file2 that are not in file1. I don’t understand how to print things that don’t match. Answer You can do it with an awk script like this: script.awk And run it like this: awk -f script.awk

Extract text with any command in linux shell

How do I extract the text from the following text and store it to the variables: Here, I want to store 05 in one variable, 21 in another, 09 in another and so on. All the value must me stored in array or in separate varibles. I have tried: I need a more clear solution or short solution. Answer Your

Finding a string between two lines in a file using linux commands

I have a file, file.txt, like this: What I want to get is the line between the last set of ‘start cal’ and ‘end cal’. I am using tac and grep to do it. But in vain. Any help please? Below is my code: What am I doing wrong? For the example above, I need the command to return ‘error’.

Advertisement