Skip to content

Tag: grep

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 reg…

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. …

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.aw…

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 ‘erro…