complex requirement


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting complex requirement
# 8  
Old 08-24-2011
The Sed command until it finds pattern END TEST puts all the lines in hold buffer (H). Once it matches a line with pattern END TEST, it starts searching for pattern TEST_DB from the lines present in the buffer, if this is found then it extracts the job name. This logic/loop continues until the end of file. To understand better technically you would need to go through Sed tutorial and Regular expressions.
This User Gave Thanks to michaelrozar17 For This Post:
# 9  
Old 08-24-2011
Hi Michael,

The command is working fine for the sample code which i gave in previous post. In real scenario for the file in which I should find the job names it is not working. The original file is around is around 500 MB containing more than 2000 jobs. So i am very confused why it is not finding the rows in that file. but the same code i tested with sample file. it is correctly picking the job names.

the command also not giving any error. it is executing for some time and finally the output file is blank.
# 10  
Old 08-24-2011
Code:
awk '/BEGIN TEST/ {
  getline
  n = $2
  while (getline > 0) {
    if (/TEST_DB/) {
      print n
      exit
    }
  }
}'

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. AIX

VIOS requirement for FC and ethernet

Hello, I have some unclear about how VIOS uses its resources. Assume that VIOS lpar has only 1 physical FC, and we use that to connect to the Lun. Then we install VIOS for the lpar on that Lun. So my question is, afterward, we can still use that physical FC for the virtual FC we create... (3 Replies)
Discussion started by: Phat
3 Replies

2. UNIX for Beginners Questions & Answers

UNIX requirement

Hi Everyone, Can anyone of you help me on how to get files creation time on ftp server/Remote server in unix. Regards, Avinash. (6 Replies)
Discussion started by: Avinash varma
6 Replies

3. UNIX for Dummies Questions & Answers

Script requirement

Please help in creating script for below requirement. I will be running 1 command and will get below entries in a text file say file44.txt ******************************* DFDL1005 06:30 00:05 ABFL2003 10/22 01:10 CFTL1256 10/24 00:10 10/25 09:20 PM ******************************** .... (3 Replies)
Discussion started by: Vinay_3308
3 Replies

4. Shell Programming and Scripting

UNIX - requirement

Hi All, I have a source file with data Name ~ Groups Muni~abc,was,USA_ax,123 Chaitanya~USA_12,was Balaji~123,xyz,was Ramu~123,xyz From the second column i want to extract only the groups that matches the pattern 'USA_%' or if the group = 'was', and ignore any other columns. ... (8 Replies)
Discussion started by: morbid_angel
8 Replies

5. Shell Programming and Scripting

Looping requirement

Hi all, I have little working knowledge in unix shell scripting. I have a requirement where i need to pull out some data in between the strings in the file. Input: TEST a a c f d TEST f e g g TEST Output: (7 Replies)
Discussion started by: satyasrin82
7 Replies

6. Shell Programming and Scripting

URGENT REQUIREMENT

1.Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for a particular day then automatically the log... (3 Replies)
Discussion started by: praveen12
3 Replies

7. Shell Programming and Scripting

Requirement

I am trying to script and came up with a conclusion that I need a do while loop in my statement. I am stuck with the do while syntax. I need to use it alongwith the if then else statement. Can I use it is a big question? I actually need to get all the files that are there from within run_dt to... (1 Reply)
Discussion started by: aronmelon
1 Replies

8. AIX

SPOT requirement

Hey May be a dumb question Can I use a SPOT which is at 5.3 TL6 to boot an LPAR (with 5.3 TL8) in to maintenance mode? Will it work ? Is it mandatory that SPOT should be of same or higher version in such case? Bala (1 Reply)
Discussion started by: balaji_prk
1 Replies
Login or Register to Ask a Question