10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" .
I have attached sample input file and the desired input should be as:
INPUT FORMAT:
SELECT
ABCD,
DEFGH,
DFGHJ,
JKLMN,
AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
2. UNIX for Beginners Questions & Answers
Hi all,
I'm looking for a way (sed or awk) to delete multiple lines between blank lines containing two patterns ex:
user: alpha
parameter_1 = 15
parameter_2 = 1
parameter_3 = 0
user: alpha
parameter_1 = 15
parameter_2 = 1
parameter_3 = 0
user: alpha
parameter_1 = 16... (3 Replies)
Discussion started by: ce9888
3 Replies
3. Shell Programming and Scripting
I have a file
Line 1 a
Line 22
Line 33
Line 1 b
Line 22
Line 1 c
Line 4
Line 5
I want to delete all lines before last occurrence of a line which contains something which is defined in a variable. Say a variable var contains 'Line 1', then I need the following in the output.
... (21 Replies)
Discussion started by: Soham
21 Replies
4. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
5. Shell Programming and Scripting
Hi,
i need help to delete all the lines between 2 matched patterns and the first pattern must be deleted too. sample as follows:
inputfile.txt
>kump_1
...........................
...........................
>start_0124
dgfhghgfh
fgfdgfh
fdgfdh
>kump_2
............................. (7 Replies)
Discussion started by: redse171
7 Replies
6. Shell Programming and Scripting
11
22
33
44
55
66
77
When pattern 55 is met, print upto it, so output is
11
22
33
44 (1 Reply)
Discussion started by: anilcliff
1 Replies
7. Shell Programming and Scripting
Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows.
header for file
1111
2222
3333
header for file
1111
2222
3333
header for file... (8 Replies)
Discussion started by: gary_w
8 Replies
8. Shell Programming and Scripting
Hi All,
Below is my requirement. Whatever coming in between ' ', needs to delete.
Input File Contents:
==============
This is nice 'boy'
This 'is
bad
boy.' Got it
Expected Output
===========
This is nice
This
Got it (4 Replies)
Discussion started by: susau_79
4 Replies
9. Shell Programming and Scripting
Hi, I've searched in this forum all day long but was not able to find enough codes to help me do a task. The only code that I can come up with is this:
sed '/ /,/ /{//p;d;}' inputfile > outputfile
I would like to sed/awk/grep a file for two patterns and then delete the lines between... (4 Replies)
Discussion started by: shamushamu
4 Replies
10. Shell Programming and Scripting
I want to delete lines like this
sed '/FROM_HERE/,/TO_HERE/d'
but I would like to *not* delete the second match, i.e. the TO_HERE line. How can I achieve this?
Thank you! (1 Reply)
Discussion started by: Ilja
1 Replies