10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
How to a first 3 lines lines that matches 1st pattern and 1 line that matches 2nd line.
Sample.txt
Line 1: /*--- ABC_BA_ABCABC -----*/
Line 2:
Line 3: insert_job: ABC_BA_ABCABC job_type: BOX
Line 4: blah blah
Line 5: max_run_alarm: 5
Line 6: blah blah
----
-----
Line 20: /*---... (4 Replies)
Discussion started by: bobbygsk
4 Replies
2. Shell Programming and Scripting
would like to print everything after matching two patterns AAA and BBB.
output :
CCC
ZZZ
sample data :
AAA
BBB
CCC
ZZZ (4 Replies)
Discussion started by: jhonnyrip
4 Replies
3. 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
4. Shell Programming and Scripting
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies
5. Shell Programming and Scripting
I have a file that contains...
Number
--------------------
1
2
3
4
i want to print all the numbers after the hyphen ... (6 Replies)
Discussion started by: ankitknit
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
i have data file like:
START1
a
b
STOP
c
d
START2
e
STOP
f
START3
g
STOP
When one of the START<count> variable is passed, i should print all lines matching this until the first 'STOP'
for example if 'START2' is provided for match, i should get the result as:
START2 (1 Reply)
Discussion started by: ysrini
1 Replies
7. Shell Programming and Scripting
Hi all,
on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern.
the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/'
I need to include the... (1 Reply)
Discussion started by: siriche
1 Replies
8. Shell Programming and Scripting
Dear Experts,
I have file called file1 in which i am greping a pattern after that i want to next 3 lines when that pattern is matched.
Ex:- file1
USA
UK
India
Africa
Hello
Asia
Europe
Australia
Hello
Peter
Robert
Jo
i want to next 3 lines after matching Hello... (12 Replies)
Discussion started by: naree
12 Replies
9. Shell Programming and Scripting
Hi,
I have file 1.txt with following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433
**
**
**
In file 2.txt I have the following entries as shown:
0152364|134444|10.20.30.40|015236433
0233654|122555|10.20.30.50|023365433... (4 Replies)
Discussion started by: imas
4 Replies
10. Shell Programming and Scripting
Hi
It is possible with sed to print a pattern within a line matching regexp?
So, the line looks like : 19:00:00 blablablabla jobid 2345 <2>
the regexp is "jobid 2345" and the pattern is 56434.
That the code for find... (2 Replies)
Discussion started by: nymus7
2 Replies