awk to ignore the text before a particular word


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk to ignore the text before a particular word
# 1  
Old 10-04-2011
awk to ignore the text before a particular word

Hi

I am new to Awk programming , i would appreciate if anyone help me with the below scenario

i have text file arranged in rows and columns like below
Code:
11004 04493384      26798  CASSI0000I   Server manager initialization started 
111004 04493486      26798 CASSI4005I  Retrieving ES configuration from 
111004 04493589      26798 CASSI1802I  Dynamic debug attachment permitted

i want to ignore all the line's till the line which contain a text "CASSI1802I" from awk parsing , so that awk can start scanning from next line after line containing text "CASSI1802I"

Moderator's Comments:
Mod Comment Please use code tags

Last edited by zaxxon; 10-04-2011 at 08:00 AM.. Reason: code tags, see pm
# 2  
Old 10-04-2011
Code:
$ awk '!/CASSI1802I/' infile
11004 04493384 26798 CASSI0000I Server manager initialization started
111004 04493486 26798 CASSI4005I Retrieving ES configuration from
$
$ grep -v "CASSI1802I" infile
11004 04493384 26798 CASSI0000I Server manager initialization started
111004 04493486 26798 CASSI4005I Retrieving ES configuration from
$


Last edited by jayan_jay; 10-04-2011 at 06:48 AM.. Reason: added grep syntax too..
# 3  
Old 10-04-2011
Thank you

But i would like to give more info
Code:
11004 04493384      26798  CASSI0000I   Server manager initialization started 
111004 04493486      26798 CASSI4005I  Retrieving ES configuration from 
111004 04493589      26798 CASSI1802I  Dynamic debug attachment permitted 
111004 04494093 26807 PRDBTCH  JCLCM0187I JOB03209 MBPDD040   
111004 04494099 26807 PRDBTCH  JCLCM0180I JOB03209 MBPDD040 
.........................
...................

about 200 to 300 lines

so i want to scan only the lines after CASSI1802I to another script to perform some task

Last edited by zaxxon; 10-04-2011 at 08:01 AM.. Reason: code tags
# 4  
Old 10-04-2011
Code:
awk 'f;/CASSI1802I/{f=1}' file

This User Gave Thanks to Franklin52 For This Post:
# 5  
Old 10-04-2011
Code:
sed -n '/CASSI1802I/,$p' input


Last edited by Franklin52; 10-04-2011 at 07:36 AM.. Reason: Please use code tags, thank you
# 6  
Old 10-04-2011
Quote:
Originally Posted by ltomuno
Code:
sed -n '/CASSI1802I/,$p' input

The OP wants the lines after CASSI1802I.
# 7  
Old 10-04-2011
Code:
$ nawk '/CASSI1802I/,EOF' infile | sed '1d'

This User Gave Thanks to jayan_jay For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to search for a word in column header that fully matches the word not partially in awk?

I have a multicolumn text file with header in the first row like this The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach for ii in ${hdr} do gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies

2. UNIX for Dummies Questions & Answers

Ignore all lines except the --- dash line in a text file.

How do you write a script to ignore all lines except the --- dash lines and then remove --- dashes from the data in a text file? Also how do you separate data in a text file with a tab (for example, column1 (software) and column2 (date) ) ? Here is my scripts : I am getting errors in... (3 Replies)
Discussion started by: dellanicholson
3 Replies

3. Shell Programming and Scripting

Retrieve information Text/Word from HTML code using awk/sed

awk/sed newbie here. I have a HTML file and from that file and I would like to retrieve a text word. <font face=arial size=-1><li><a href=/value_for_clients/Tokyo/abc_process.txt>abc</a> NDK Version: 4.0 </li> <font face=arial size=-1><li><a... (6 Replies)
Discussion started by: sk2code
6 Replies

4. Shell Programming and Scripting

Grep to isolate a text file line and Awk to select a word?

I am looking at using grep to locate the line in the text file and them use awk to select a word or words out of it. I know awk needs -v to allow a variable to be used, but also needs -F to allow the break up of the sentence and allow the location of separate variables. $line = grep "1:" File |... (8 Replies)
Discussion started by: Ironguru
8 Replies

5. Shell Programming and Scripting

Extract word from text (sed,awk, etc...)

Hello, I need some help extracting the number after the RBA e.g 15911688 from the below block of text (e.g: grep RBA |sed .......). The code should be valid for blocks if text generated at different times as well and not for the below text only. ... (2 Replies)
Discussion started by: drbiloukos
2 Replies

6. Shell Programming and Scripting

regex - start with a word but ignore that word

Hi Guys. I guess I have a very basic query but stuck with it :( I have a file in which I want to extract particular content. The content is between standard format like : Verify stats A=0 B=12 C=34 TEST Failed Now I want to extract data between "Verify stats" & "TEST Failed" but do... (6 Replies)
Discussion started by: ratneshnagori
6 Replies

7. Shell Programming and Scripting

Ignore records with no values through awk

Hi Guys, Hope you are doing well out there. I have to format the output of a script. Current output is auktltbr.dc-dublin.de:4322 ICCIR2Test13-PB-01 active auktltbr.dc-dublin.de:8322 ICCIR2Test13-SB-02 active auktlttr.dc-dublin.de:4422 ICCIR2Test24-CB-02 active... (10 Replies)
Discussion started by: singh.chandan18
10 Replies

8. Shell Programming and Scripting

Ignore first word using sed in PERL

Please help me in ignoring first word in a line example Input log 123^Babd^Basdf789^B098^Bouiou Desired output abd,asdf789,098,ouiou 123 should be ignored is this possible using sed regular expressions Use code tags - you got a PM with a guide. (2 Replies)
Discussion started by: thankful123
2 Replies

9. UNIX for Advanced & Expert Users

Script to ignore word from a line ...

Hi Gurus, I'm need of a script in which we are finding an independent word ‘boy' in a log file. We are using grep in order to do the same. Now in this log file there are some sentences where we see ‘This is a boy' and we do not want to count word ‘boy' from this sentence. So in other word we want... (2 Replies)
Discussion started by: heyitsmeok
2 Replies

10. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies
Login or Register to Ask a Question