file separated into paragraphs or pages


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file separated into paragraphs or pages
# 1  
Old 11-24-2011
Question file separated into paragraphs or pages

hi,

i have file,

file is separated into parahgraphs by these line(----------).
i want to find out logId = string : "AIALARM", in each parahgraph or page
if found then i want to cut next five lines....

--------------------------------------------------------------------------------------------------------------------------
Code:
 M-GET CONFIRMATION (
     INVOKE IDENTIFIER       173965,
     LINKED IDENTIFIER       18351,
     MANAGED OBJECT CLASS    stateChangeRecord,
     MANAGED OBJECT INSTANCE {
                                 logId = string : "AIALARM",
                                 logRecordId = number : 62237
                             },
     CURRENT TIME            "20111121000332",
     ATTRIBUTE LIST          {
                                 objectClass stateChangeRecord,
                                 nameBinding logRecord-log,
                                 managedObjectClass signRouteSetNePart,
                                 managedObjectInstance {
                                     mtpSignPointId = numericName : 4,
                                     signRouteSetNePartId = bit14 : 5239
                                 },
                                 eventType stateChange,
                                 eventTime "20111103084546",
                                 logRecordId number : 62237,
                                 loggingTime "20111103084546",
                                 packages {
                                     attributeIdentifierListPackage, sourceIndicatorPackage,
                                     eventTimePackage
                                 },
                                 attributeIdentifierList { GAAGDA1C.administrativeState },
                                 sourceIndicator managementOperation,
                                 stateChangeDefinition {
                                     {
                                         attributeID       GAAGDA1C.administrativeState,
                                         oldAttributeValue GAAASA1C.AdministrativeState : unlocked,
                                         newAttributeValue GAAASA1C.AdministrativeState : locked
                                     }
                                 }
                             }
 )

--------------------------------------------------------------------------------------------------------------------------

please suggest.
thanks


Moderator's Comments:
Mod Comment How to use code tags

Last edited by Franklin52; 11-24-2011 at 03:34 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 11-24-2011
Are you looking for this ?

Quote:

awk '/logId = string : "AIALARM"/ {for(i=0;i<4;i++) {print;if(!getline) exit;} }' inputFile.txt
# 3  
Old 11-24-2011
Code:
$ nawk 'c-->0;/logId = string : "AIALARM"/{print;c=5}' infile

# 4  
Old 11-24-2011
thanlks frnds
its working ...
1 thing more
1 want to cut jst 1st and last filed from a file ...i dont knw how many filrs are there ?how it is possble?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to cut a pipe delimited file and paste it with another file to form a comma separated outputfile

Hello ppl I have a requirement to split (cut in unix) a file (A.txt) which is a pipe delimited file into A1.txt and A2.txt Now I have to join (paste in unix) this A2.txt with external file A3.txt to form output file A4.txt which should be CSV (comma separated file) so that third party can... (25 Replies)
Discussion started by: etldev
25 Replies

2. UNIX for Dummies Questions & Answers

[solved] Comma separated values to space separated

Hi, I have a large number of files which are written as csv (comma-separated values). Does anyone know of simple sed/awk command do achieve this? Thanks! ---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ---------- Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies

3. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: ehabaziz2001
1 Replies

4. Shell Programming and Scripting

Comma separated file

Hi all, I have the following files types: FileA: 100, 23, 33, FileB: 22, 45, 78, and i want to make File C: 100,22 23,45 33,78 any nice suggestions for making it easy. (3 Replies)
Discussion started by: hen1610
3 Replies

5. Shell Programming and Scripting

splitting a large text file into paragraphs

Hello all, newbie here. I've searched the forum and found many "how to split a text file" topics but none that are what I'm looking for. I have a large text file (~15 MB) in size. It contains a variable number of "paragraphs" (for lack of a better word) that are each of variable length. A... (3 Replies)
Discussion started by: lupin..the..3rd
3 Replies

6. Shell Programming and Scripting

How to format file into comma separated text file?

Hi Guys, I have text file which is tab/space separated but I want it to re-format into a comma separated and trim the spaces in between. Can someone spare me a perl or sed script that can do the job? INPUT FILE: 500010245623 500 21-APR-11 05.58.21 PM ... (14 Replies)
Discussion started by: pinpe
14 Replies

7. OS X (Apple)

rm -f a text file separated by \n

Hello guys, this is my first post here. Before I reformated my Time Machine Backups drive, I copied several thousands of files to another drive. After using "Tidy Up!" I constantly had errors telling me I didn't have enough privileges to erase duplicate files. I tried everything I could. Using... (4 Replies)
Discussion started by: aficiomaquinas
4 Replies

8. Shell Programming and Scripting

how to filter out some paragraphs in a file

Hi, I am trying to filter out those paragraphs that contains 'CONNECT', 'alter system switch logfile'. That means say the input file is : ------------------------------------------------------- Wed Jun 7 00:32:31 2006 ACTION : 'CONNECT' CLIENT USER: prdadm CLIENT TERMINAL: Wed Jun 7... (7 Replies)
Discussion started by: cnlhap
7 Replies

9. Shell Programming and Scripting

how to sort paragraphs by date within a file

hi all i want help in sortng date in paragraphs within file , i want to ask as if there any option to sort a certain pattern of file not the rest of file.i.e the data of file become sorted with respect to date i have a log file as follows !! *A0628/081 /08-01-10/13 H... (1 Reply)
Discussion started by: nabmufti
1 Replies

10. Shell Programming and Scripting

how to extract paragraphs from file in BASH script followed by prefix ! , !! and !!!

I]hi all i am in confusion since last 2 days :( i posted thraed yesterday and some friends did help but still i couldnt get solution to my problem let it be very clear i have a long log file of alkatel switch and i have to seperate the minor major and critical alarms shown by ! , !! and !!!... (6 Replies)
Discussion started by: nabmufti
6 Replies
Login or Register to Ask a Question