Posted by: Saajha June 7, 2007
SHELL SCRIPT HELP...
Login in to Rate this Post:     0       ?        
That's an interesting approach haami, So you defined 'numb' = total number of lines in the file 'after' = total number -2 Then you grepped that 'after' to get the result, correct? Hmm, that's agreeable -- but the situation is different here. It's a huge text file -- close to thousand pages long ..so the file doesn't end immediately. Also, the string repeats after random intervals; which means there is no way of specifying its occurence in terms of line number. Once again, following are the lines (let me try explaining in Nepali as per sangfroid): "I want this listed" "I am the KEY: List Me" "I want this listed" yo tin-wata lines chahi hunai parchha hai --- Aba 4th line optional chha. 5th line we are not concerned with -- tara 4th line nai extend bhayera 5th, 6th pugna sakchha.. So, "I am the KEY: List Me" chahi every random interval ma auchha..! Aba m=1 ta thik chha, n = 1 pani thik chha, as long as there is no line 4, line 5 or more..tara what if there is line 4 +. ..!! The Good News is : Line 4 ko string pani given chha "If I exist, list me too; ..." The Bad News is : Grep is already looking for the string "I am the KEY: List Me" The Proposal is: Dui wata string lai nai search pattern ma PIPE garera halna sakyo bhane ta problem solve hunuparchha hola ...since it looks for both character strings and gives out only the lines corresponding to those two. The Enhanced Proposal is: Tyo Line 4 extend bhayo bhane 'cut c-01-150' le 150 characters search garchha, and that would include the other line too. Tyo line ma 150 characters chhaina bhane, it would simply give us the ones that are present. Tara pani, there must be a better way to do that. Solution: :( ? Thanks Guys !! ~@~ PS: Sorry about Nep-English confusion --
Read Full Discussion Thread for this article