I have a logcat file from adb. the file is like follwoing,
09-03 17:12:04.562 479 957 I ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 1230
09-03 17:12:04.687 479 1030 I ActivityManager: Start proc com.amazon.mShop.android for activity com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity: pid=19164 uid=10158 gids={1006, 3003}
09-03 17:12:05.593 479 912 I ActivityManager: Starting: Intent { dat=?paramSuggestionText=cell%20phone flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 17:12:05.796 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity: +186ms (total +1s119ms)
09-03 17:12:08.601 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity: +3s925ms
09-03 17:12:08.601 479 620 I ActivityManager: Resumed Activity: com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity totalTime: 4037 ms
09-03 17:13:35.742 479 957 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.categoryBrowse.CategoryBrowseActivity } from pid 19164
09-03 17:13:36.007 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.categoryBrowse.CategoryBrowseActivity: +222ms
09-03 17:13:53.328 479 957 I ActivityManager: Starting: Intent { dat=?¶mSuggestionFilters=s%3An%3A%2C%3A4991425011%0As%3An%3A%2C%3A4991426011%0As%3An%3A%2C%3A5088769011%0As%3An%3A%2C%3A5263615011¶mDepartmentName=Programs flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 17:13:53.484 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity: +145ms
09-03 17:14:54.585 479 484 I ActivityManager: Starting: Intent { cmp=com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity } from pid 19164
09-03 17:14:54.718 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity: +102ms
09-03 17:15:30.210 479 957 I ActivityManager: Starting: Intent { flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:03:02.140 479 967 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x4000000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 19164
09-03 18:03:08.054 479 1005 I ActivityManager: Starting: Intent { dat= flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:03:08.171 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity: +105ms
09-03 18:04:24.937 479 967 I ActivityManager: Starting: Intent { cmp=com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity } from pid 19164
09-03 18:04:25.046 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity: +92ms
09-03 18:05:00.554 479 5949 I ActivityManager: Starting: Intent { flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:06:43.781 479 1019 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x4000000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 19164
09-03 18:07:12.984 479 1001 I ActivityManager: Starting: Intent { dat= flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:07:13.140 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity: +135ms
09-03 18:08:29.890 479 5949 I ActivityManager: Starting: Intent { cmp=com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity } from pid 19164
09-03 18:08:29.976 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity: +81ms
09-03 18:09:05.515 479 961 I ActivityManager: Starting: Intent { flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:18:42.132 479 1039 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.categoryBrowse.CategoryBrowseActivity } from pid 19164
09-03 18:18:42.359 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.categoryBrowse.CategoryBrowseActivity: +144ms
09-03 18:19:09.890 479 1030 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x4000000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 19164
09-03 18:19:17.406 479 485 I ActivityManager: Starting: Intent { dat= flg=0x20000 cmp=com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity (has extras) } from pid 19164
09-03 18:19:17.515 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity: +97ms
09-03 18:20:58.500 479 5949 I ActivityManager: Starting: Intent { flg=0x20000 cmp=com.amazon.mShop.android/.search.image.SnapItActivity } from pid 19164
09-03 18:20:58.546 479 967 I ActivityManager: Starting: Intent { cmp=com.amazon.mShop.android/.search.image.SnapItPhotoCaptureActivity } from pid 19164
09-03 18:20:58.898 479 620 I ActivityManager: Displayed com.amazon.mShop.android/.search.image.SnapItPhotoCaptureActivity: +340ms (total +387ms)
09-03 18:21:26.156 479 1039 I ActivityManager: Starting: Intent { cmp=com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity } from pid 19164
09-03 18:21:26.359 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity: +185ms
09-03 18:21:42.750 479 957 W ActivityManager: Duplicate finish request for HistoryRecord{408f9da0 com.amazon.mShop.android/com.amazon.mShop.barcodeSearch.BarcodeFirstTryTipActivity}
09-03 18:26:05.968 479 963 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x4000000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 19164
09-03 18:27:53.515 479 957 I ActivityManager: Starting: Intent { flg=0x10000000 cmp=com.amazon.mShop.android/com.amazon.mobileads.mraid.MraidBrowser (has extras) } from pid 19164
09-03 18:27:54.750 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mobileads.mraid.MraidBrowser: +1s218ms
09-03 18:29:12.726 479 484 I ActivityManager: Starting: Intent { act=intentActionStartActivity flg=0x4000000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity (has extras) } from pid 19164
09-03 18:29:15.609 479 1039 I ActivityManager: Starting: Intent { flg=0x10000000 cmp=com.amazon.mShop.android/com.amazon.mobileads.mraid.MraidBrowser (has extras) } from pid 19164
09-03 18:29:16.882 479 620 I ActivityManager: Displayed com.amazon.mShop.android/com.amazon.mobileads.mraid.MraidBrowser: +1s261ms
09-03 18:32:41.750 479 967 I ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.amazon.mShop.android/com.amazon.mShop.home.HomeActivity } from pid 1230
Now I want to extract the activity name from the file. It is to be extracted from each line similar to this,
09-03 18:29:15.609 479 1039 I ActivityManager: Starting: Intent { flg=0x10000000 cmp=com.amazon.mShop.android/com.amazon.mobileads.mraid.MraidBrowser (has extras) } from pid 19164
or
09-03 17:12:08.601 479 620 I ActivityManager: Resumed Activity: com.amazon.mShop.android/com.amazon.mShop.search.SearchActivity totalTime: 4037 ms
from this line I only need the string com.amazon.mobileads.mraid.MraidBrowser other parts of the line needs to be removed. lines that does not contain Starting:Intent or ActivityManager: Resumed Activity: should be removed.
In the end I will have a sequence of strings like,
com.amazon.mobileads.mraid.MraidBrowser
com.amazon.mShop.search.SearchActivity
and so on depending on their line number.
How can I achieve this? I can use string tokenizer but that is a tedious and inefficient process, regex matching or something similar will be better i think.