Store and isolate bad pages from a file to new file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Store and isolate bad pages from a file to new file
# 1  
Old 09-05-2012
Store and isolate bad pages from a file to new file

I have a file like below . The good pages must have 3 conditions :
The pages that containing page total only must have 50 lines.
The pages that containing customer total only must have 53 lines.
The last page of Customer Total should be the last page.
How can I accomplish separating good pages from bad pages using GAWK ?
File :
-------
Code:
FFstarting good page1(50 line) Account number :    12500149 
.. 
.. 
.. 
Total of page : 5555 
FFstarting good page2(50 line) Account number :    12500149 
.. 
.. 
.. 
Total of page : 6666 
FFstarting good page3(53 line) Account number :    12500149 
.. 
.. 
.. 
Total of page : 6666 
Total Customer : 999.99 
FFstarting BAD page1(Not 50 line) Account number :    12500148 
.. 
.. 
.. 
Total of page : 5555 
FFstarting BAD page2(Not 50 line) Account number :    12500148 
.. 
.. 
.. 
Total of page : 6666 
FFstarting BAD page3(Not 53 line) Account number :    12500148 
.. 
.. 
.. 
Total of page : 6666 
Total Customer : 999.99

Moderator's Comments:
Mod Comment Please view this code tag video for how to use code tags when posting code and data.

Last edited by vbe; 09-05-2012 at 09:35 AM..
# 2  
Old 09-10-2012
You store up entire pages in a variable, not passing anything, counting lines, until you see one of the total signatures, then decide on the line count where to write it. At EOF, you need to dispose of the last page from the variable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strip the first record off a file and isolate fields off of it

I have a 2 part question on how to this in unix scripting using kshell or c shell. I have a file described below: 1st record has 2 fields on it every other record has 22 fields on it. Example ABC, email address Detail 1 Detail 2 Detail 3 . . . 1st question is... (4 Replies)
Discussion started by: jclanc8
4 Replies

2. Solaris

How to isolate a bad dimm by command on Solaris 10 host?

Hello, I have a HP ProLiant DL385 ( X86 ) running Solaris 10 on it. Our hardware team passwd by server last night and noticed an amber light to indicate a possible bad dimm. /var/adm/messages, dmesg, prtdiag -v, all shows nothing. /opt/HPQhealth/sbin/hpasmcli indicated I have a bad... (5 Replies)
Discussion started by: sunnychen98
5 Replies

3. UNIX for Dummies Questions & Answers

I need to isolate a date in a large log file

I wrote head -n1 example.log I grab the first line of the log, but I need to isolate just the date, which is 08/May/2012:09:52:52. I also need to find the reverse of this, which would be tail... http://i.imgur.com/Lp1eBD0.png Thanks in advance (4 Replies)
Discussion started by: spookydll
4 Replies

4. Shell Programming and Scripting

Remove bad records from file and move them into a file then send those via email

Hi my requirement is that i want pull the bad records from input file and move those records in to a seperate file. that file has to be sent via email.. any suggentions please (1 Reply)
Discussion started by: sxk4999
1 Replies

5. 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

6. Shell Programming and Scripting

awk: isolate a part of a file name

hi there, i have a file named 'x20080613_x20100106.pwr1.gc', i want to isolate the part 'x20080613_x20100106' but by using the following line i isolate the part '.pwr1.gc': `awk '$0=substr($0, length($0)-7)' $temp` how can i reverse that? thank you! (3 Replies)
Discussion started by: friend
3 Replies

7. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

8. UNIX for Dummies Questions & Answers

sed to isolate file paths separated by a pattern

Hi, I've been searching for a quick way to do this with sed, but to no avail. I have a file containing a long series of (windows) file paths that are separated by the pattern '@'. I would like to extract each file path so that I can later assign a variable to each path. Here is the file:... (2 Replies)
Discussion started by: nixjennings
2 Replies

9. Shell Programming and Scripting

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (2 Replies)
Discussion started by: shilendrajadon
2 Replies

10. UNIX for Advanced & Expert Users

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (1 Reply)
Discussion started by: shilendrajadon
1 Replies
Login or Register to Ask a Question