Experts,
You all have been very supportive of me so far & Im thankful for it.
I need to extract data between two sets of parenthesis and also between quotes.
cat LOGFILE | grep 'number wasnt' | head -2
I. 2011/04/14 01:12:03. process(130) Deleting Text on line 11 (ESN:27723211621B01DJ68AG) because a number wasnt 'AVAILABLE' and is not found in the database
I. 2011/04/14 01:12:03. process(130) Deleting Text on line 12 (ESN:27723211634ATADJ68AK) because a number wasnt 'AVAILABLE' and is not found in the database
what I need is "27723211621B01DJ68AG" & "AVAILABLE".
So here is what I do -
cat LOGFILE | grep -i 'number wasnt' | cut -d'(' -f3 | sed -e 's/[a-z].//g' | sed -e 's/SN://g' -e 's/)//g' | tr -d "'" | head -2
E27723211621B01DJ68AG AVAILABLE
E27723211634ATADJ68AK AVAILABLE
The solution that Im using right now works and this has to do with eliminating all of unnecessary characters instead of extracting what I need(which definitely is not elegant at all).
But owing to my limited understand of regex, I coded this way.
However there is new change and we need to pull in even the "130" which is in the first set of quotes at the beginning and Im not sure as how to go about this.
Simply stated, here is what I have -
I. 2011/04/14 01:12:03. process(130) Deleting Text on line 11 (ESN:27723211621B01DJ68AG) because a number wasnt 'AVAILABLE' and is not found in the database
I. 2011/04/14 01:12:03. process(130) Deleting Text on line 12 (ESN:27723211634ATADJ68AK) because a number wasnt 'AVAILABLE' and is not found in the database
and I need
130 27723211621B01DJ68AG AVAILABLE.
How do I get this.
please help,
regards,
Lee.