Search a String between start and end of a block in a file
Hi,
I have a scenario where I want to display the output based on the pattern search between the start and end of a block in a file, we can have multiple start and end blocks in a file.
Example give below, we need to search between the start block abc and end block def in a file, after that display the block which has the word "123" in a line. I have tried this command:
, but how can we code to identify the block which has 123 word and print that entire block(refer expected out below). Please guide me in resolving this issue. Thanks all in Advance for helping!
Input file: values.txt
Expected Output:
Last edited by Chubler_XL; 02-22-2018 at 08:23 PM..
Reason: Please use [code] and [/code] tags around data and programs
Not sure if the title of this thread makes sense, but hopefully my explanation will.
I'm using awk to print some stats from an apache accesslog. I would like to specify the regexp condition where only the two root pages of "index.html" and "/" are counted in my results. What I can't figure out... (3 Replies)
Hi ,
I have below file with 13 columns. I need 2-13 columns seperated by comma and I want to append each row with a string "INSERT INTO xxx" in the begining as 1st column and then a variable "$node" and then $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13 and at the end another string " ; COMMIT;"
... (4 Replies)
How can I do this? Actually I have a file which contains a path
e.g.
/home/john/Music/hello.mp3
and I want to take only the filename (hello.mp3) So, I need to read the file from its end to its start till the character "/"
Is this possible?
Thanks, I am sure you'll not disappoint me here!
Oh,... (9 Replies)
I am trying to extract a string from a line of text. Currently I am using
grep -o 'startofstring(.........'
The string is not always the same size.
The string I'm trying to extract starts with 'test(' ends with ')'.
ex "blah,blah,blah,test(stringoftext),blah blah"
How do I... (4 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Dear All
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB... (5 Replies)
Hello
I'm using cygwin and wouldlike extract information from an xml file according specific values, but don't know how.
Let's say in a file content looks like this:
<tab>
SURNAME=Mustermann
NAME=Max
CUSTOMER SINCE= 18.01.2000
ADDRESS=Birmingham
... (2 Replies)
My file (the output of an experiment) starts off looking like this,
_____________________________________________________________
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
**********************************************************************
Subject 1,... (9 Replies)
Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file:
Input File format:
SELECT
ABCD,
DEFGH,... (2 Replies)