LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-19-2003, 01:28 AM   #1
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Rep: Reputation: 30
sed & grep script?


I don't know if I am doing the right thing or the wrong thing here. I'm uncertain.

I have a program that reports information into a log file ever 3 seconds. When a player joins the server, it reports it. When the player leaves the server, it reports it.

I'm creating a script that uses grep to take the lines with the players joining and leaving and isolate them into a tempary storage place.

I then use sed to make the isolated information, awk usable.

But the problem is, I can not figure out how to get my script to find matchs from peices of those who joined, and peices of those who left and request a delete of both.

This is important because my objective is to setup the program to display "only" the players that are "currently" in the game.

If someone can give me a hint, idea, or even help me with this, I would be most greatful.

This is what my log file looks like after my script works with it:

[Wed Sep 17 18:58:03]~Haunted-Within~ON
[Wed Sep 17 19:01:28]~jman3000~ON
[Wed Sep 17 19:01:30]~Divine_Dragon_~ON
[Wed Sep 17 19:03:31]~ELDERFOX~ON
[Wed Sep 17 19:04:50]~Phanser Adoze~ON
[Wed Sep 17 19:05:36]~ELDERFOX~ON
[Wed Sep 17 19:08:01]~Cloud Zero~ON
[Wed Sep 17 19:09:32]~James Darren~ON
[Wed Sep 17 19:12:12]~Joe Crow~ON
[Wed Sep 17 19:15:59]~chris crow~ON
[Wed Sep 17 19:17:00]~SKULLEY~ON
[Wed Sep 17 19:21:30]~TurBs~ON
[Wed Sep 17 19:24:04]~Xul Tei-Quin~ON
[Wed Sep 17 19:24:17]~Marty The Great~ON
[Wed Sep 17 19:24:50]~Xul Tei-Quin~ON
[Wed Sep 17 19:29:29]~mytvisgood~ON
[Wed Sep 17 19:31:33]~Divine_Dragon_~ON
[Wed Sep 17 19:33:58]~mmnnbb~ON
[Wed Sep 17 19:37:43]~Pippin_hawk~ON
[Wed Sep 17 19:39:57]~The_Blonde_One~ON
[Wed Sep 17 19:49:20]~Webler~ON
[Wed Sep 17 19:51:58]~Divine_Dragon_~ON
[Wed Sep 17 19:53:58]~dehlvinn~ON
[Wed Sep 17 19:54:36]~Phanser Adoze~ON
[Wed Sep 17 20:03:03]~Shredotron~ON
[Wed Sep 17 20:04:25]~Pippin_hawk~ON
[Wed Sep 17 20:06:44]~Duke Fister~ON
[Wed Sep 17 20:14:40]~Ghotmori~ON
[Wed Sep 17 20:15:02]~quentinn~ON
[Wed Sep 17 20:24:43]~ELDERFOX~ON
[Wed Sep 17 20:25:05]~Xul Tei-Quin~ON
[Wed Sep 17 20:30:25]~ZePlAr-RaIdErZ~ON
[Wed Sep 17 20:36:55]~Phanser Adoze~ON
[Wed Sep 17 20:40:10]~Dark Shaman2~ON
[Wed Sep 17 20:41:10]~halfdemon_lover~ON
[Wed Sep 17 20:43:35]~Dajimmer~ON
[Wed Sep 17 20:43:46]~Larogoth~ON
[Wed Sep 17 20:44:22]~Ecanor~ON
[Wed Sep 17 20:48:51]~James Darren~ON
[Wed Sep 17 20:49:42]~Nintendo_Dude~ON
[Wed Sep 17 20:50:36]~soundforgames~ON
[Wed Sep 17 20:53:42]~DarkStepp~ON
[Wed Sep 17 20:57:15]~Rushby~ON
[Wed Sep 17 20:57:39]~pobunny~ON
[Wed Sep 17 21:01:42]~Marty The Great~ON
[Wed Sep 17 21:03:22]~ma'drynn~ON
[Wed Sep 17 21:03:28]~Ash Logain~ON
[Wed Sep 17 21:07:12]~SKULLEY~ON
[Wed Sep 17 21:12:45]~Ulrich Von Ventura~ON
[Wed Sep 17 21:14:44]~wolvreen~ON
[Wed Sep 17 21:15:35]~SpiritWarrior339~ON
[Wed Sep 17 21:16:32]~Crazlatinboy77~ON
[Wed Sep 17 21:18:17]~Cloud Zero~ON
[Wed Sep 17 21:20:48]~Garrisek~ON
[Wed Sep 17 21:21:06]~ciarra~ON
[Wed Sep 17 21:21:50]~mytvisgood~ON
[Wed Sep 17 21:24:00]~Souldealer~ON
[Wed Sep 17 21:24:23]~Kittiekissz~ON
[Wed Sep 17 21:25:02]~klackdink~ON
[Wed Sep 17 21:25:09]~rsherroc~ON
[Wed Sep 17 21:26:13]~CH47Wind~ON
[Wed Sep 17 21:26:31]~Nicky510~ON
[Wed Sep 17 21:27:11]~tcjg2~ON
[Wed Sep 17 23:24:15]~sirru~ON
[Wed Sep 17 23:51:25]~justin hoskins~ON
[Thu Sep 18 00:21:02]~Faber95~ON
[Thu Sep 18 00:33:49]~roninmetu~ON
[Thu Sep 18 00:34:40]~roninmetu~ON
[Thu Sep 18 00:35:23]~Lord Leo~ON
[Thu Sep 18 00:43:35]~kitz247~ON
[Thu Sep 18 01:50:20]~locutus3000~ON
[Thu Sep 18 01:51:38]~ipanacea~ON
[Thu Sep 18 01:51:51]~FosterZen~ON
[Thu Sep 18 02:25:57]~Brodur~ON
[Thu Sep 18 03:22:37]~dolvmin03~ON
[Thu Sep 18 03:23:34]~dolvmin03~ON
[Thu Sep 18 03:27:45]~dolvmin03~ON
[Thu Sep 18 03:31:07]~dolvmin03~ON~*
[Thu Sep 18 06:14:01]~Divine_Dragon_~ON
[Thu Sep 18 06:20:10]~Black-loaden~ON
[Thu Sep 18 06:28:38]~Divine_Dragon_~ON
[Thu Sep 18 06:30:28]~Divine_Dragon_~ON
[Thu Sep 18 07:16:03]~Lcarlsen~ON
[Thu Sep 18 07:54:30]~SheaTannerson~ON
[Thu Sep 18 09:21:16]~Embra Bowdragon~ON
[Thu Sep 18 10:00:57]~roninmetu~ON
[Thu Sep 18 10:17:00]~ASIHUNTER~ON
[Thu Sep 18 10:18:12]~ASIHUNTER~ON
[Thu Sep 18 10:19:02]~eli the hunt~ON
[Thu Sep 18 10:26:59]~Cloud Zero~ON
[Thu Sep 18 10:31:13]~Sunny5000~ON
[Thu Sep 18 10:41:22]~RaY_EX~ON
[Thu Sep 18 10:45:44]~Jeztah~ON
[Thu Sep 18 10:49:32]~bigroa~ON
[Thu Sep 18 10:50:24]~Aaron the Grimreaper~ON
[Thu Sep 18 10:51:58]~jakebates~ON
[Thu Sep 18 10:54:51]~The Dirty Azn~ON
[Thu Sep 18 11:09:37]~Aman Sanar~ON
[Thu Sep 18 11:14:12]~whmice~ON
[Thu Sep 18 11:17:25]~LEE169477~ON
[Thu Sep 18 11:17:44]~LEE169477~ON
[Thu Sep 18 11:26:26]~galadriel darkstar~ON
[Thu Sep 18 11:27:11]~anaurion~ON
[Thu Sep 18 11:29:33]~The Dirty Azn~ON
[Thu Sep 18 11:31:35]~RaY_EX~ON
[Thu Sep 18 11:33:22]~whmice~ON
[Thu Sep 18 11:35:49]~kessa 500~ON
[Thu Sep 18 11:41:42]~vendomslayer~ON
[Thu Sep 18 11:49:29]~Fergoose~ON
[Thu Sep 18 11:50:22]~Rushby~ON
[Thu Sep 18 11:52:57]~zeke29~ON
[Thu Sep 18 11:53:07]~PitMaster~ON
[Thu Sep 18 11:53:53]~Artic666~ON
[Thu Sep 18 11:54:50]~Gobboandorc~ON
[Thu Sep 18 11:57:13]~The Dirty Azn~ON
[Thu Sep 18 12:00:57]~Gimzur~ON
[Thu Sep 18 12:01:56]~Sneb730~ON
[Thu Sep 18 12:08:32]~RavenstormX~ON
[Thu Sep 18 12:09:52]~Sunny5000~ON
[Thu Sep 18 12:10:49]~Vash-Stampede~ON
[Thu Sep 18 12:12:08]~roninmetu~ON
[Thu Sep 18 12:13:51]~anaurion~ON
[Thu Sep 18 12:17:08]~Diseva~ON
[Thu Sep 18 12:20:29]~Sunny5000~ON
[Thu Sep 18 12:23:49]~killer 696~ON
[Thu Sep 18 12:24:44]~RaY_EX~ON
[Thu Sep 18 12:24:45]~vendomslayer~ON
[Thu Sep 18 12:25:11]~Fergoose~ON
[Thu Sep 18 12:25:12]~Cloud Zero~ON
[Thu Sep 18 12:26:04]~SparNa~ON
[Thu Sep 18 12:28:37]~Sunny5000~ON
[Thu Sep 18 12:31:53]~Sneb730~ON
[Thu Sep 18 12:31:56]~killer 696~ON
[Thu Sep 18 12:39:08]~Sunny5000~ON
[Thu Sep 18 12:39:54]~Night WOLFjke~ON
[Thu Sep 18 12:44:29]~Sunny5000~ON
[Thu Sep 18 12:45:39]~Chef Mike~ON
[Thu Sep 18 12:53:37]~Chef Mike~ON
[Thu Sep 18 12:56:06]~samo101~ON
[Thu Sep 18 12:57:39]~Sunny5000~ON
[Thu Sep 18 13:05:18]~RogarStorm~ON
[Thu Sep 18 13:08:44]~Ian Godfrey~ON
[Thu Sep 18 13:21:11]~Foirin Holf~ON
[Thu Sep 18 13:26:26]~RavenstormX~ON
[Thu Sep 18 13:31:09]~Sunny5000~ON
[Thu Sep 18 13:43:52]~Ronnoc~ON
[Thu Sep 18 13:57:17]~roninmetu~ON
[Thu Sep 18 13:59:04]~Ronnoc~ON
[Thu Sep 18 13:59:10]~Skippyj~ON
[Thu Sep 18 14:00:31]~_OmegaNemisis_~ON
[Thu Sep 18 14:01:25]~Erbuzz~ON
[Thu Sep 18 14:06:22]~l3Jay~ON
[Thu Sep 18 14:06:36]~Goblin StormKrow~ON
[Thu Sep 18 14:10:14]~Instid~ON
[Thu Sep 18 14:10:27]~Sunny5000~ON
[Thu Sep 18 14:11:22]~_OmegaNemisis_~ON
[Thu Sep 18 14:17:18]~Sunny5000~ON
[Thu Sep 18 14:35:39]~ZePlAr-RaIdErZ~ON
[Thu Sep 18 14:43:05]~justin hoskins~ON
[Thu Sep 18 16:30:42]~GhorGhor1~ON
[Thu Sep 18 16:34:12]~hsiangsun~ON
[Thu Sep 18 16:46:56]~Durfinger~ON
[Thu Sep 18 16:48:20]~Divine_Dragon_~ON
[Thu Sep 18 16:51:58]~Divine_Dragon_~ON
[Thu Sep 18 17:03:37]~ralaboubou~ON
[Thu Sep 18 17:04:28]~Divine_Dragon_~ON
[Thu Sep 18 17:05:15]~Bryce Rosenbloom~ON
[Thu Sep 18 17:07:06]~Divine_Dragon_~ON
[Thu Sep 18 17:07:36]~Divine_Dragon_~ON
[Thu Sep 18 17:10:36]~Elvishperamedic~ON
[Thu Sep 18 17:12:23]~Paul7330~ON
[Thu Sep 18 17:14:51]~blacknight1233~ON
[Thu Sep 18 17:16:26]~blacknight1233~ON
[Thu Sep 18 17:17:26]~PhyscoStar~ON
[Thu Sep 18 17:17:52]~Elvishperamedic~ON
[Thu Sep 18 17:19:20]~xhrisstrom~ON
[Thu Sep 18 17:20:37]~Paul7330~ON
[Thu Sep 18 17:38:13]~Elvishperamedic~ON
[Thu Sep 18 17:38:38]~Aladoran~ON
[Thu Sep 18 17:41:15]~freetripman~ON
[Thu Sep 18 17:45:56]~Death_Shoes~ON
[Thu Sep 18 17:51:20]~Bryce Rosenbloom~ON
[Thu Sep 18 18:00:54]~Cloud Zero~ON
[Thu Sep 18 18:04:53]~James Darren~ON
[Thu Sep 18 18:06:15]~Sneb730~ON
[Thu Sep 18 18:09:35]~TurBs~ON
[Thu Sep 18 18:13:06]~Truncs~ON
[Thu Sep 18 18:14:54]~The Dirty Azn~ON
[Thu Sep 18 18:17:40]~Elvishperamedic~ON
[Thu Sep 18 18:20:46]~Xedoe~ON
[Thu Sep 18 18:29:41]~Sapphire Knight~ON
[Thu Sep 18 18:30:58]~Woomonger~ON
[Thu Sep 18 18:32:59]~Ciridon~ON
[Thu Sep 18 18:36:23]~speeddemon498~ON
[Thu Sep 18 18:42:09]~mrmoo574~ON
[Thu Sep 18 18:43:39]~VincentBlackrock~ON
[Thu Sep 18 18:44:39]~Woomonger~ON
[Thu Sep 18 18:51:40]~Nintendo_Dude~ON
[Thu Sep 18 18:52:49]~aoi-chan~ON
[Thu Sep 18 18:55:32]~roninmetu~ON
[Thu Sep 18 18:57:07]~Frypup~ON
[Thu Sep 18 18:57:20]~Wraithwave~ON
[Thu Sep 18 19:01:36]~SKULLEY~ON
[Thu Sep 18 19:05:50]~Nintendo_Dude~ON
[Thu Sep 18 19:06:48]~PhyscoStar~ON
[Thu Sep 18 19:10:53]~ArmpitLint~ON
[Thu Sep 18 19:11:03]~Divine_Dragon_~ON
[Thu Sep 18 19:15:39]~Naediian Sykoelf~ON
[Thu Sep 18 19:16:10]~Vickyac7~ON
[Thu Sep 18 19:23:55]~ArmpitLint~ON
[Thu Sep 18 19:27:38]~Divine_Dragon_~ON
[Thu Sep 18 19:28:23]~GhorGhor1~ON
[Thu Sep 18 19:31:18]~natiaruith~ON
[Thu Sep 18 19:32:21]~Mew64~ON
[Thu Sep 18 19:37:46]~DooRooP~ON
[Thu Sep 18 19:39:16]~Mew64~ON
[Thu Sep 18 19:40:52]~Alvaro1712~ON
[Thu Sep 18 19:42:56]~Divine_Dragon_~ON
[Thu Sep 18 19:44:34]~The Dirty Azn~ON
[Thu Sep 18 19:47:26]~SKULLEY~ON
[Thu Sep 18 19:48:49]~DooRooP~ON
[Thu Sep 18 19:52:16]~Divine_Dragon_~ON
[Thu Sep 18 19:57:05]~Fenix56~ON
[Thu Sep 18 20:00:00]~warmongerbeast~ON
[Thu Sep 18 20:03:50]~Juamez~ON
[Thu Sep 18 20:13:25]~Kittiekissz~ON
[Thu Sep 18 20:13:27]~lordnazgul~ON
[Thu Sep 18 20:21:44]~Sneb730~ON
[Thu Sep 18 20:26:17]~NetardedRoob~ON
[Thu Sep 18 20:35:48]~Divine_Dragon_~ON
[Thu Sep 18 20:38:50]~The Dirty Azn~ON
[Thu Sep 18 20:40:51]~Xul Tei-Quin~ON
[Thu Sep 18 20:46:23]~Nagash1776~ON
[Thu Sep 18 20:49:40]~SPIRIT_WIND_~ON
[Thu Sep 18 20:51:19]~Divine_Dragon_~ON
[Thu Sep 18 20:52:16]~Utopia_Vulcano~ON
[Thu Sep 18 20:52:41]~Zepp1112~ON
[Thu Sep 18 20:52:48]~Divine_Dragon_~ON
[Thu Sep 18 20:54:39]~Phanser Adoze~ON
[Thu Sep 18 20:55:50]~EternalChaos88~ON
[Thu Sep 18 20:56:59]~solussanctum~ON
[Thu Sep 18 20:59:50]~ZePlAr-RaIdErZ~ON
[Thu Sep 18 21:04:38]~Xul Tei-Quin~ON
[Thu Sep 18 21:10:52]~Sir Gerd~ON
[Thu Sep 18 21:13:22]~DooRooP~ON
[Thu Sep 18 21:15:48]~MagicOnslaught~ON
[Thu Sep 18 21:17:07]~mytvisgood~ON
[Thu Sep 18 21:21:17]~Goblin StormKrow~ON
[Thu Sep 18 21:21:28]~Brenem Talahorn~ON
[Thu Sep 18 21:23:19]~Brenem Talahorn~ON
[Thu Sep 18 21:23:25]~Phanser Adoze~ON
[Thu Sep 18 21:27:08]~odinoftheoneeye~ON
[Thu Sep 18 21:27:51]~Xul Tei-Quin~ON
[Thu Sep 18 21:30:27]~Xul Tei-Quin~ON
[Thu Sep 18 21:32:02]~Sojourne~ON
[Thu Sep 18 21:33:41]~Bryce Rosenbloom~ON
[Thu Sep 18 21:34:17]~Kenshinz~ON
[Thu Sep 18 21:34:59]~Sojourne~ON
[Thu Sep 18 21:35:26]~Drizzf~ON
[Thu Sep 18 21:36:58]~Garrisek~ON
[Thu Sep 18 21:43:25]~DropTheBomb~ON
[Thu Sep 18 21:45:20]~KoRNKuRLZ~ON
[Thu Sep 18 21:47:16]~Sojourne~ON
[Thu Sep 18 21:51:51]~caretaker~ON
[Thu Sep 18 21:52:32]~WarRanger~ON
[Thu Sep 18 21:55:05]~murphball_123~ON
[Thu Sep 18 21:57:37]~edein~ON
[Thu Sep 18 21:59:58]~FallenAngel666 ver2~ON
[Thu Sep 18 22:00:28]~Fenix56~ON
[Thu Sep 18 22:02:14]~roninmetu~ON
[Thu Sep 18 22:03:19]~shuran 134~ON
[Thu Sep 18 22:05:37]~roninmetu~ON
[Thu Sep 18 22:05:54]~Bryce Rosenbloom~ON
[Thu Sep 18 22:06:49]~CanisN17~ON
[Thu Sep 18 22:07:32]~rhephatae~ON
[Thu Sep 18 22:09:23]~James Darren~ON
[Thu Sep 18 22:09:25]~jarenti~ON
[Thu Sep 18 22:10:56]~Ambulocetus~ON
[Thu Sep 18 22:11:00]~ciarra~ON
[Thu Sep 18 22:11:04]~KaCee51Sr~ON
[Thu Sep 18 22:11:37]~dehlvinn~ON
[Thu Sep 18 22:13:15]~trunks57~ON
[Thu Sep 18 22:13:52]~KoRNKuRLZ~ON
[Thu Sep 18 22:15:29]~MANGESENDESVAGINS~ON
[Thu Sep 18 22:16:26]~FosterZen~ON
[Thu Sep 18 22:20:05]~trunks57~ON
[Thu Sep 18 22:25:39]~Maximus 218~ON
[Thu Sep 18 22:29:08]~puddle1~ON
[Thu Sep 18 22:41:19]~wes_1029~ON
[Thu Sep 18 22:42:04]~Tan Tun~ON
[Thu Sep 18 22:45:15]~Masakato~ON
[Thu Sep 18 22:47:29]~wes_1029~ON
[Thu Sep 18 22:49:36]~mega ha~ON
[Thu Sep 18 22:52:34]~Agnt_Mulder~ON
[Thu Sep 18 22:53:53]~Agnt_Mulder~ON
[Thu Sep 18 23:04:23]~DARKKNIGHT5~ON
[Thu Sep 18 23:07:26]~Nagash1776~ON
[Thu Sep 18 23:07:49]~Zepp1112~ON
[Thu Sep 18 23:08:41]~Nagash1776~ON
[Thu Sep 18 23:31:36]~dolvmin03~ON~*
[Thu Sep 18 23:48:48]~evelome~ON
[Thu Sep 18 23:50:51]~Alphastrike321~ON
[Fri Sep 19 00:14:12]~Bel Lord of the First~ON
[Fri Sep 19 00:18:25]~Bao-shi~ON
[Fri Sep 19 00:24:34]~Bao-shi~ON
[Fri Sep 19 00:43:08]~Gangrel~ON
[Fri Sep 19 00:45:02]~Balrack~ON
[Fri Sep 19 00:53:24]~Balrack~ON
[Fri Sep 19 01:27:26]~RedKetchup~ON
[Fri Sep 19 01:29:12]~SPIRIT_WIND_~ON
[Fri Sep 19 01:32:24]~Hearth~ON
[Fri Sep 19 01:39:15]~Hearth~ON
[Fri Sep 19 01:51:15]~spyvar~ON
[Fri Sep 19 01:58:56]~rhephatae~ON
[Fri Sep 19 02:05:57]~rhephatae~ON
[Fri Sep 19 02:07:50]~rhephatae~ON
[Fri Sep 19 02:08:29]~FallenAngel666 ver2~ON
[Wed Sep 17 19:03:52]~ELDERFOX~OFF
[Wed Sep 17 19:12:42]~Joe Crow~OFF
[Wed Sep 17 19:17:52]~chris crow~OFF
[Wed Sep 17 19:19:13]~ELDERFOX~OFF
[Wed Sep 17 19:21:04]~jman3000~OFF
[Wed Sep 17 19:22:03]~Divine_Dragon_~OFF
[Wed Sep 17 19:24:00]~Haunted-Within~OFF
[Wed Sep 17 19:24:34]~Xul Tei-Quin~OFF
[Wed Sep 17 19:25:42]~Marty The Great~OFF
[Wed Sep 17 19:38:16]~Pippin_hawk~OFF
[Wed Sep 17 19:40:07]~The_Blonde_One~OFF
[Wed Sep 17 19:40:27]~mmnnbb~OFF
[Wed Sep 17 19:46:49]~Divine_Dragon_~OFF
[Wed Sep 17 19:47:46]~James Darren~OFF
[Wed Sep 17 19:48:03]~Phanser Adoze~OFF
[Wed Sep 17 19:51:41]~mytvisgood~OFF
[Wed Sep 17 19:53:35]~Webler~OFF
[Wed Sep 17 19:54:11]~Xul Tei-Quin~OFF
[Wed Sep 17 19:57:37]~TurBs~OFF
[Wed Sep 17 20:14:47]~Ghotmori~OFF
[Wed Sep 17 20:15:37]~Duke Fister~OFF
[Wed Sep 17 20:16:26]~Pippin_hawk~OFF
[Wed Sep 17 20:26:04]~Shredotron~OFF
[Wed Sep 17 20:26:54]~Xul Tei-Quin~OFF
[Wed Sep 17 20:28:20]~ELDERFOX~OFF
[Wed Sep 17 20:28:30]~Divine_Dragon_~OFF
[Wed Sep 17 20:33:01]~quentinn~OFF
[Wed Sep 17 20:35:02]~Phanser Adoze~OFF
[Wed Sep 17 20:37:53]~ZePlAr-RaIdErZ~OFF
[Wed Sep 17 20:41:31]~halfdemon_lover~OFF
[Wed Sep 17 20:46:12]~Dark Shaman2~OFF
[Wed Sep 17 20:47:38]~Ecanor~OFF
[Wed Sep 17 20:48:02]~Larogoth~OFF
[Wed Sep 17 20:54:37]~soundforgames~OFF
[Wed Sep 17 20:56:48]~SKULLEY~OFF
[Wed Sep 17 21:02:09]~Dajimmer~OFF
[Wed Sep 17 21:02:13]~Marty The Great~OFF
[Wed Sep 17 21:05:00]~DarkStepp~OFF
[Wed Sep 17 21:06:10]~ma'drynn~OFF
[Wed Sep 17 21:07:34]~Nintendo_Dude~OFF
[Wed Sep 17 21:08:23]~Ash Logain~OFF
[Wed Sep 17 21:16:27]~Rushby~OFF
[Wed Sep 17 21:17:31]~wolvreen~OFF
[Wed Sep 17 21:18:16]~Cloud Zero~OFF
[Wed Sep 17 21:19:56]~Cloud Zero~OFF
[Wed Sep 17 21:22:42]~SpiritWarrior339~OFF
[Wed Sep 17 21:23:24]~Garrisek~OFF
[Wed Sep 17 21:25:52]~dehlvinn~OFF
[Wed Sep 17 21:26:05]~Kittiekissz~OFF
[Wed Sep 17 21:29:18]~mytvisgood~OFF
[Wed Sep 17 21:29:43]~ciarra~OFF
[Wed Sep 17 21:30:12]~pobunny~OFF
[Wed Sep 17 23:24:32]~sirru~OFF
[Wed Sep 17 23:53:55]~justin hoskins~OFF
[Thu Sep 18 00:32:47]~Faber95~OFF
[Thu Sep 18 00:34:24]~roninmetu~OFF
[Thu Sep 18 00:45:01]~roninmetu~OFF
[Thu Sep 18 00:58:54]~kitz247~OFF
[Thu Sep 18 01:51:54]~FosterZen~OFF
[Thu Sep 18 01:53:15]~locutus3000~OFF
[Thu Sep 18 01:53:55]~ipanacea~OFF
[Thu Sep 18 02:08:05]~Lord Leo~OFF
[Thu Sep 18 02:26:00]~Brodur~OFF
[Thu Sep 18 03:22:42]~dolvmin03~OFF
[Thu Sep 18 03:25:57]~dolvmin03~OFF
[Thu Sep 18 03:30:41]~dolvmin03~OFF
[Thu Sep 18 03:51:32]~dolvmin03~OFF
[Thu Sep 18 06:28:19]~Divine_Dragon_~OFF
[Thu Sep 18 06:29:04]~Divine_Dragon_~OFF
[Thu Sep 18 06:32:28]~Black-loaden~OFF
[Thu Sep 18 06:35:46]~Divine_Dragon_~OFF
[Thu Sep 18 07:21:41]~Lcarlsen~OFF
[Thu Sep 18 07:56:44]~SheaTannerson~OFF
[Thu Sep 18 09:21:20]~Embra Bowdragon~OFF
[Thu Sep 18 10:12:08]~roninmetu~OFF
[Thu Sep 18 10:17:56]~ASIHUNTER~OFF
[Thu Sep 18 10:18:54]~ASIHUNTER~OFF
[Thu Sep 18 10:31:16]~Sunny5000~OFF
[Thu Sep 18 10:46:50]~Jeztah~OFF
[Thu Sep 18 10:50:41]~eli the hunt~OFF
[Thu Sep 18 10:53:03]~Aaron the Grimreaper~OFF
[Thu Sep 18 10:56:26]~jakebates~OFF
[Thu Sep 18 10:59:50]~bigroa~OFF
[Thu Sep 18 11:12:37]~Aman Sanar~OFF
[Thu Sep 18 11:17:31]~LEE169477~OFF
[Thu Sep 18 11:29:11]~The Dirty Azn~OFF
[Thu Sep 18 11:29:33]~LEE169477~OFF
[Thu Sep 18 11:31:22]~RaY_EX~OFF
[Thu Sep 18 11:33:04]~whmice~OFF
[Thu Sep 18 11:36:06]~kessa 500~OFF
[Thu Sep 18 11:36:35]~anaurion~OFF
[Thu Sep 18 11:39:59]~whmice~OFF
[Thu Sep 18 11:49:52]~Fergoose~OFF
[Thu Sep 18 11:50:28]~galadriel darkstar~OFF
[Thu Sep 18 11:54:53]~Artic666~OFF
[Thu Sep 18 11:56:50]~The Dirty Azn~OFF
[Thu Sep 18 11:58:30]~PitMaster~OFF
[Thu Sep 18 12:03:28]~Gobboandorc~OFF
[Thu Sep 18 12:10:23]~Sunny5000~OFF
[Thu Sep 18 12:13:52]~RavenstormX~OFF
[Thu Sep 18 12:14:39]~anaurion~OFF
[Thu Sep 18 12:15:33]~Vash-Stampede~OFF
[Thu Sep 18 12:19:01]~Diseva~OFF
[Thu Sep 18 12:19:37]~zeke29~OFF
[Thu Sep 18 12:20:44]~Sunny5000~OFF
[Thu Sep 18 12:24:48]~vendomslayer~OFF
[Thu Sep 18 12:25:16]~Fergoose~OFF
[Thu Sep 18 12:28:48]~Sunny5000~OFF
[Thu Sep 18 12:40:54]~Night WOLFjke~OFF
[Thu Sep 18 12:41:43]~Sunny5000~OFF
[Thu Sep 18 12:44:32]~Sneb730~OFF
[Thu Sep 18 12:46:37]~Sunny5000~OFF
[Thu Sep 18 12:50:56]~Chef Mike~OFF
[Thu Sep 18 12:59:50]~RaY_EX~OFF
[Thu Sep 18 12:59:51]~Chef Mike~OFF
[Thu Sep 18 13:00:28]~samo101~OFF
[Thu Sep 18 13:10:36]~RogarStorm~OFF
[Thu Sep 18 13:12:54]~killer 696~OFF
[Thu Sep 18 13:14:28]~SparNa~OFF
[Thu Sep 18 13:19:20]~Sunny5000~OFF
[Thu Sep 18 13:22:24]~Foirin Holf~OFF
[Thu Sep 18 13:28:12]~RavenstormX~OFF
[Thu Sep 18 13:31:33]~Ian Godfrey~OFF
[Thu Sep 18 13:41:01]~Cloud Zero~OFF
[Thu Sep 18 13:41:42]~Sunny5000~OFF
[Thu Sep 18 13:51:47]~Ronnoc~OFF
[Thu Sep 18 14:00:45]~Skippyj~OFF
[Thu Sep 18 14:02:38]~Ronnoc~OFF
[Thu Sep 18 14:07:05]~l3Jay~OFF
[Thu Sep 18 14:09:59]~Erbuzz~OFF
[Thu Sep 18 14:11:03]~_OmegaNemisis_~OFF
[Thu Sep 18 14:16:07]~Instid~OFF
[Thu Sep 18 14:16:31]~Sunny5000~OFF
[Thu Sep 18 14:30:49]~Goblin StormKrow~OFF
[Thu Sep 18 14:36:57]~Sunny5000~OFF
[Thu Sep 18 16:35:13]~GhorGhor1~OFF
[Thu Sep 18 16:35:34]~hsiangsun~OFF
[Thu Sep 18 16:47:12]~Durfinger~OFF
[Thu Sep 18 16:51:49]~Divine_Dragon_~OFF
[Thu Sep 18 16:52:01]~Divine_Dragon_~OFF
[Thu Sep 18 17:06:53]~Divine_Dragon_~OFF
[Thu Sep 18 17:07:25]~Divine_Dragon_~OFF
[Thu Sep 18 17:16:00]~blacknight1233~OFF
[Thu Sep 18 17:16:01]~Divine_Dragon_~OFF
[Thu Sep 18 17:16:24]~Elvishperamedic~OFF
[Thu Sep 18 17:17:22]~Paul7330~OFF
[Thu Sep 18 17:17:57]~blacknight1233~OFF
[Thu Sep 18 17:18:54]~PhyscoStar~OFF
[Thu Sep 18 17:20:29]~xhrisstrom~OFF
[Thu Sep 18 17:26:46]~ralaboubou~OFF
[Thu Sep 18 17:32:32]~Paul7330~OFF
[Thu Sep 18 17:33:42]~Bryce Rosenbloom~OFF
[Thu Sep 18 17:37:30]~Elvishperamedic~OFF
[Thu Sep 18 17:38:46]~Aladoran~OFF
[Thu Sep 18 17:57:10]~freetripman~OFF
[Thu Sep 18 18:01:27]~Elvishperamedic~OFF
[Thu Sep 18 18:05:41]~James Darren~OFF
[Thu Sep 18 18:08:39]~Death_Shoes~OFF
[Thu Sep 18 18:16:04]~Truncs~OFF
[Thu Sep 18 18:16:51]~Bryce Rosenbloom~OFF
[Thu Sep 18 18:18:35]~Sneb730~OFF
[Thu Sep 18 18:20:26]~TurBs~OFF
[Thu Sep 18 18:31:03]~Woomonger~OFF
[Thu Sep 18 18:31:40]~Sapphire Knight~OFF
[Thu Sep 18 18:34:17]~Ciridon~OFF
[Thu Sep 18 18:36:24]~Xedoe~OFF
[Thu Sep 18 18:39:08]~speeddemon498~OFF
[Thu Sep 18 18:44:23]~VincentBlackrock~OFF
[Thu Sep 18 18:45:47]~Woomonger~OFF
[Thu Sep 18 18:53:50]~Elvishperamedic~OFF
[Thu Sep 18 18:55:23]~aoi-chan~OFF
[Thu Sep 18 18:55:50]~roninmetu~OFF
[Thu Sep 18 18:57:57]~Wraithwave~OFF
[Thu Sep 18 18:58:47]~mrmoo574~OFF
[Thu Sep 18 18:59:45]~Frypup~OFF
[Thu Sep 18 19:05:25]~Nintendo_Dude~OFF
[Thu Sep 18 19:08:01]~PhyscoStar~OFF
[Thu Sep 18 19:11:14]~ArmpitLint~OFF
[Thu Sep 18 19:19:46]~Divine_Dragon_~OFF
[Thu Sep 18 19:23:34]~Vickyac7~OFF
[Thu Sep 18 19:29:23]~GhorGhor1~OFF
[Thu Sep 18 19:30:33]~ArmpitLint~OFF
[Thu Sep 18 19:30:34]~Naediian Sykoelf~OFF
[Thu Sep 18 19:32:57]~Divine_Dragon_~OFF
[Thu Sep 18 19:39:12]~Mew64~OFF
[Thu Sep 18 19:39:23]~natiaruith~OFF
[Thu Sep 18 19:44:14]~The Dirty Azn~OFF
[Thu Sep 18 19:46:17]~Mew64~OFF
[Thu Sep 18 19:46:48]~SKULLEY~OFF
[Thu Sep 18 19:47:06]~DooRooP~OFF
[Thu Sep 18 19:48:41]~Nintendo_Dude~OFF
[Thu Sep 18 19:49:02]~Alvaro1712~OFF
[Thu Sep 18 19:52:08]~Divine_Dragon_~OFF
[Thu Sep 18 19:59:02]~DooRooP~OFF
[Thu Sep 18 20:02:44]~warmongerbeast~OFF
[Thu Sep 18 20:13:39]~lordnazgul~OFF
[Thu Sep 18 20:16:21]~Kittiekissz~OFF
[Thu Sep 18 20:20:45]~Juamez~OFF
[Thu Sep 18 20:28:36]~NetardedRoob~OFF
[Thu Sep 18 20:31:47]~Divine_Dragon_~OFF
[Thu Sep 18 20:34:56]~SKULLEY~OFF
[Thu Sep 18 20:38:29]~The Dirty Azn~OFF
[Thu Sep 18 20:38:41]~Sneb730~OFF
[Thu Sep 18 20:46:31]~Nagash1776~OFF
[Thu Sep 18 20:51:03]~Divine_Dragon_~OFF
[Thu Sep 18 20:52:03]~Divine_Dragon_~OFF
[Thu Sep 18 20:56:11]~Phanser Adoze~OFF
[Thu Sep 18 20:58:02]~SPIRIT_WIND_~OFF
[Thu Sep 18 20:59:58]~Utopia_Vulcano~OFF
[Thu Sep 18 21:00:39]~EternalChaos88~OFF
[Thu Sep 18 21:02:38]~Zepp1112~OFF
[Thu Sep 18 21:03:43]~Xul Tei-Quin~OFF
[Thu Sep 18 21:10:53]~Divine_Dragon_~OFF
[Thu Sep 18 21:13:47]~Sir Gerd~OFF
[Thu Sep 18 21:14:17]~ZePlAr-RaIdErZ~OFF
[Thu Sep 18 21:14:19]~DooRooP~OFF
[Thu Sep 18 21:15:22]~Fenix56~OFF
[Thu Sep 18 21:15:50]~MagicOnslaught~OFF
[Thu Sep 18 21:23:07]~Brenem Talahorn~OFF
[Thu Sep 18 21:23:29]~Goblin StormKrow~OFF
[Thu Sep 18 21:27:34]~Xul Tei-Quin~OFF
[Thu Sep 18 21:28:05]~Brenem Talahorn~OFF
[Thu Sep 18 21:30:03]~odinoftheoneeye~OFF
[Thu Sep 18 21:30:13]~Xul Tei-Quin~OFF
[Thu Sep 18 21:32:25]~Sojourne~OFF
[Thu Sep 18 21:35:12]~Sojourne~OFF
[Thu Sep 18 21:37:56]~Kenshinz~OFF
[Thu Sep 18 21:40:03]~Xul Tei-Quin~OFF
[Thu Sep 18 21:43:21]~mytvisgood~OFF
[Thu Sep 18 21:43:25]~Garrisek~OFF
[Thu Sep 18 21:44:46]~Drizzf~OFF
[Thu Sep 18 21:50:06]~Sojourne~OFF
[Thu Sep 18 21:54:53]~caretaker~OFF
[Thu Sep 18 21:57:57]~murphball_123~OFF
[Thu Sep 18 22:03:05]~WarRanger~OFF
[Thu Sep 18 22:03:41]~shuran 134~OFF
[Thu Sep 18 22:05:13]~roninmetu~OFF
[Thu Sep 18 22:05:37]~Bryce Rosenbloom~OFF
[Thu Sep 18 22:06:36]~KoRNKuRLZ~OFF
[Thu Sep 18 22:11:03]~Ambulocetus~OFF
[Thu Sep 18 22:12:08]~James Darren~OFF
[Thu Sep 18 22:15:36]~MANGESENDESVAGINS~OFF
[Thu Sep 18 22:16:10]~trunks57~OFF
[Thu Sep 18 22:17:38]~DropTheBomb~OFF
[Thu Sep 18 22:17:43]~edein~OFF
[Thu Sep 18 22:18:26]~Phanser Adoze~OFF
[Thu Sep 18 22:21:56]~KaCee51Sr~OFF
[Thu Sep 18 22:22:10]~Bryce Rosenbloom~OFF
[Thu Sep 18 22:22:21]~KoRNKuRLZ~OFF
[Thu Sep 18 22:24:12]~FallenAngel666 ver2~OFF
[Thu Sep 18 22:25:17]~FosterZen~OFF
[Thu Sep 18 22:25:45]~Cloud Zero~OFF
[Thu Sep 18 22:25:45]~roninmetu~OFF
[Thu Sep 18 22:26:32]~rhephatae~OFF
[Thu Sep 18 22:28:39]~Fenix56~OFF
[Thu Sep 18 22:30:41]~trunks57~OFF
[Thu Sep 18 22:37:24]~jarenti~OFF
[Thu Sep 18 22:40:38]~Maximus 218~OFF
[Thu Sep 18 22:40:39]~puddle1~OFF
[Thu Sep 18 22:41:25]~ciarra~OFF
[Thu Sep 18 22:45:43]~wes_1029~OFF
[Thu Sep 18 22:45:54]~The Dirty Azn~OFF
[Thu Sep 18 22:45:57]~Masakato~OFF
[Thu Sep 18 22:47:52]~Tan Tun~OFF
[Thu Sep 18 22:48:30]~wes_1029~OFF
[Thu Sep 18 22:53:02]~Agnt_Mulder~OFF
[Thu Sep 18 22:53:11]~CanisN17~OFF
[Thu Sep 18 22:53:55]~Agnt_Mulder~OFF
[Thu Sep 18 23:04:44]~DARKKNIGHT5~OFF
[Thu Sep 18 23:07:31]~Nagash1776~OFF
[Thu Sep 18 23:08:07]~Zepp1112~OFF
[Thu Sep 18 23:09:22]~Nagash1776~OFF
[Thu Sep 18 23:10:21]~mega ha~OFF
[Thu Sep 18 23:24:34]~dehlvinn~OFF
[Fri Sep 19 00:06:05]~Alphastrike321~OFF
[Fri Sep 19 00:06:38]~evelome~OFF
[Fri Sep 19 00:12:35]~dolvmin03~OFF
[Fri Sep 19 00:17:18]~Bel Lord of the First~OFF
[Fri Sep 19 00:23:47]~Bao-shi~OFF
[Fri Sep 19 00:24:05]~solussanctum~OFF
[Fri Sep 19 00:30:28]~Bao-shi~OFF
[Fri Sep 19 00:45:25]~Balrack~OFF
[Fri Sep 19 00:51:03]~Gangrel~OFF
[Fri Sep 19 00:53:45]~Balrack~OFF
[Fri Sep 19 01:33:04]~RedKetchup~OFF
[Fri Sep 19 01:39:14]~Hearth~OFF
[Fri Sep 19 01:55:57]~Hearth~OFF
[Fri Sep 19 02:04:48]~rhephatae~OFF
[Fri Sep 19 02:06:02]~spyvar~OFF
[Fri Sep 19 02:07:13]~rhephatae~OFF
[Fri Sep 19 02:13:24]~rhephatae~OFF
[Fri Sep 19 02:14:20]~FallenAngel666 ver2~OFF


Any matches between ON and OFF need to be deleted.

Last edited by dolvmin; 09-19-2003 at 01:30 AM.
 
Old 09-19-2003, 01:46 AM   #2
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
Well, I got one thing that works, but I don't think I'm any closer then I was before.

if [ "$(grep ~*~OFF filename)" = "$(grep ~*~ON filename) ];then

echo "This ain't going to work!"

else

echo "Told ya!"

fi

It won't work because the OFF and ON are not =.

Would I somehow use a pipe "|" on this?
 
Old 09-19-2003, 01:59 AM   #3
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
I tried:

grep ~*~ON filename | grep ~*~OFF filename > test.mem

Then I did:

grep ~*~OFF filename > test1.mem

Then I did:

wc -l test.mem

wc -l test1.mem

I have more lines in test.mem then I did in test1.mem. I was hoping for a match.

So that command string didn't work <sighs>
 
Old 09-19-2003, 02:09 AM   #4
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
I just thought of something. I think the awk command might just be my savior.
 
Old 09-19-2003, 02:26 AM   #5
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
I thought about doing something this:

sed 's/"$(grep OFF filename)//g' filename > filename2

Problem with this is, it will only delete those flagged with OFF and not touch ON. I want those flagged with OFF to delete the same ones with ON then delete the ones with OFF. Man, my mind is exploading lol
 
Old 09-19-2003, 03:07 AM   #6
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
Okay, I tried this out...

# Buffer.mem is full log of all ON and OFF players

grep OFF buffer.mem > test.mem
sed 's/OFF//g' test.mem > test2.mem
sed 's/[[]//g' test2.mem > test.mem
sed 's/...................]//g' test.mem > test2.mem

grep ON buffer.mem > p.mem
sed 's/ON//g' p.mem > p2.mem
sed 's/[[]//g' p2.mem > p.mem
sed 's/...................]//g' p.mem > p2.mem

sed 's/$(grep * test2.mem)//g' p2.mem > p3.mem

All it did was say I had new mail and copied everything from p2.mem into p3.mem.

Last edited by dolvmin; 09-19-2003 at 03:09 AM.
 
Old 09-20-2003, 02:58 AM   #7
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
If your only aim is to find out what users are online at a given moment, I think you can do it 'on the fly', with one line of code, and without any temporary files.

You shall only check what was the last action (ON or OFF) of each user.
If it was ON, the user is online.

This line does the trick:
tac logfile | sort | uniq | awk '{printf $2 " " $1 "\n"}' | uniq -f 1 | grep ON | awk '{printf $1 "\n"}'

The input of the above command shall be in logfile, and each line should look like this:

user action

(There should be no spaces in either user or in action)

So, the above line needs some tweaking, but I think it can do the task.

What is your opinion?

Last edited by J_Szucs; 09-20-2003 at 03:06 AM.
 
Old 09-21-2003, 04:05 AM   #8
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
I just entered the string into a script file. Give me 24hrs. I'll give you all the feed back I get.

BTW, very impressive. 1 line, gz. lol
 
Old 09-21-2003, 05:26 AM   #9
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
Okay, it apears to be failing. I had 1 player on line, verified it manually in the logs, but the string failed to report it.

Here's a LOG sample:

[Sun Sep 21 05:14:16]~Cameron H~ON~
[Sun Sep 21 05:42:32]~neverolivier~ON~
[Sun Sep 21 05:49:48]~Mjordin~ON~
[Sun Sep 21 05:57:36]~cao200~ON~
[Sun Sep 21 05:16:55]~Cameron H~OFF~
[Sun Sep 21 05:48:45]~neverolivier~OFF~
[Sun Sep 21 05:53:20]~Mjordin~OFF~


*NOTICE: There is no "~OFF~ Status for cao200. He is online.

Here's the script:

#! /bin/bash
# Chris Jepson
# 09-21-03 [6:20AM EST]
# This is a test script to display players currently on line.

LOGDIR=/home/nwserver/logs.0
LOGFILE=/home/nwserver/logs.0/nwserverLog1.txt
BUFFER=/home/nwserver/logs.0/buffer.mem
BUFFER2=/home/nwserver/logs.0/buffer2.mem
LOG=/home/nwserver/logs.0/PLAYER.LOG

LOOP=1

while [ "$LOOP"!=0 ]
do

clear

grep Joined $LOGFILE > $BUFFER
grep Left $LOGFILE >> $BUFFER

sed 's/] /]~/g' $BUFFER > $BUFFER2
sed 's/ (........) Joined as Player [0-9]/~ON~/g' $BUFFER2 > $BUFFER
sed 's/ (........) Joined as Player [0-9][0-9]/~ON~/g' $BUFFER > $BUFFER2
sed 's/ Left as a Player (..............)/~OFF~/g' $BUFFER2 > $BUFFER
sed 's/ Left as a Player (...............)/~OFF~/g' $BUFFER > $BUFFER2
sed 's/[.]//g' $BUFFER2 > $LOG

tac $LOG | sort | uniq | awk '{printf $2 " " $1 "\n"}' | uniq -f 1 | grep ON | awk '{printf $1 "\n"}'

sleep 4

done

Any feedback you can give me would be most helpful.
 
Old 09-21-2003, 05:53 AM   #10
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Well, in the meantime I also noticed the script only gives correct results in specific cases, which I tried :-( .

I also found what the problem is: the first 'sort' pipe sorts the lines on the whole line, and not on the 'user' field only.
If we could establish that 'sort' only sorts the lines on the 'user' field (and othervise leave the lines in the positional order), then the whole thing would work.

If you issue the 'sort' command like this: sort +1, then sort will sort on the second field (e.g. username).
The problem is that even if you specify on which field to sort, 'sort' will also sort on other fields, not leaving the lines in the positional order.

This is the last problem to solve for the script to work.
 
Old 09-21-2003, 09:35 AM   #11
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Is this what you want:
Code:
#! /bin/bash

# Location of the file shown in your first post
ALLONOFF="/PATH/TO/ON-OFF-ENTRIES"

# Need sed to strip (multiple) spaces in username
for THIS_USER in `cat ${ALLONOFF} | sed 's/ [ ]*//g' | awk -F~ '{ print $2 }' | sort | uniq`
do

  NO_ONLINE="`cat  ${ALLONOFF} | sed 's/ [ ]*//g' | grep ${THIS_USER} | grep -c '~ON'`"
  NO_OFFLINE="`cat  ${ALLONOFF} | sed 's/ [ ]*//g' | grep ${THIS_USER} | grep -c '~OFF'`"

  if (( ${NO_ONLINE} != ${NO_OFFLINE} && ${NO_ONLINE} > ${NO_OFFLINE} ))
  then
    echo "${THIS_USER} : Still on-line."
  fi

done
My startingpoint for this problem:
If the amount off ON's equals the amount of OFF's for a specific user he/she must be off-line.

In theory there can be more OFF's then ON's for a specific, which would give you a false hit. That's why the && ${NO_ONLINE} > ${NO_OFFLINE} part is included.

I don't know if you have a correct output of the file you show in your first post, but this is the result after feeding that info into the above script:

CH47Wind : Still on-line.
CloudZero : Still on-line.
Crazlatinboy77 : Still on-line.
Gimzur : Still on-line.
JamesDarren : Still on-line.
Nicky510 : Still on-line.
PhanserAdoze : Still on-line.
RaY_EX : Still on-line.
Rushby : Still on-line.
SKULLEY : Still on-line.
SPIRIT_WIND_ : Still on-line.
Sneb730 : Still on-line.
Souldealer : Still on-line.
TheDirtyAzn : Still on-line.
UlrichVonVentura : Still on-line.
ZePlAr-RaIdErZ : Still on-line.
_OmegaNemisis_ : Still on-line.
justinhoskins : Still on-line.
killer696 : Still on-line.
klackdink : Still on-line.
roninmetu : Still on-line.
rsherroc : Still on-line.
tcjg2 : Still on-line.
vendomslayer : Still on-line.

Which are 24 on-line users.

Let's hope I didn't overlook something
 
Old 09-21-2003, 01:05 PM   #12
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
I knew sort can do it!

Others on this thread: http://www.linuxquestions.org/questi...608#post491608 helped me realize that only the slightest modification is needed for the first script to work:

tac logfile | awk '{ printf $2 " " $1 "\n" }' | sort -s +1 | uniq | uniq -f 1 | grep ON | awk '{ printf $2 "\n" }'

You might prefer to return the results on one line separated by ',' , this can do it:
tac logfile | awk '{ printf $2 " " $1 "\n" }' | sort -s +1 | uniq | uniq -f 1 | grep ON | awk '{ printf $2 ", " }'

(though you may want to remove the last trailing ', ' after the line is built)

Last edited by J_Szucs; 09-21-2003 at 01:56 PM.
 
Old 09-21-2003, 03:30 PM   #13
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Your original idea of counting ON and OFF actions is OK, I simply prefer doing everything with sed, awk, sort and grep, as I am fascinated with the power and speed of these commands.
If you follow your original idea, you inevitably need a script to cycle through each username and count their actions.

My idea may provide you the easiness of trying and tweaking it on the command line, then append it to your script when it works.
I saw the possibility that the last action of each user could be easily found by some sorting and if it was an ON action, then the user is online.

So, here is the final, complete solution for analyzing the player.log file in a previous post of yours:

tac player.log | sed 's/ /%+/g' | sed 's/~/ /g' | awk '{ printf $3 " " $2 "\n" }' | sort -s +1 | uniq | uniq -f 1 | grep ON | awk '{ printf $2 ", " }' | sed 's/%+/ /g' | sed 's/, $//'

The above line produces the following output when feeding your example lines to it: cao200

Since uniq does not seem to handle field delimiters other than space, I replaced spaces in usernames with a string '%+' (which I replace back to space in the last step), and I also replace the '~' field delimiter to space.
This was done with three additional sed commands.

If there are more than one user online, then the script outputs them on one line, using ', ' as the separator. So, the output of the script is a string, in which all users online are listed.
The last sed command removes the unnecessary, trailing ', ' characters from the end of the output line.
 
Old 09-21-2003, 04:41 PM   #14
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
The one-liner works for the short example, but an error occurs when feeding it the longlist shown in the first post.

Error:
awk: cmd. line:1: (FILENAME=- FNR=15) fatal: not enough arguments to satisfy format string
`ON Bel%+Lord%+of%+the%+First
'
^ ran out for this one

printf is the culprint. Change the following and it will work:

awk '{ printf $3 " " $2 "\n" }'
to
awk '{ printf("%s%s%s\n", $3, " " , $2)}'

and

awk '{ printf $2 ", " }'
to
awk '{ printf("%s%s", $2, ", ")}'

Also, I get 24 active on-line hits, you 186. One of us is doing something wrong

Last edited by druuna; 09-21-2003 at 04:50 PM.
 
Old 09-21-2003, 04:57 PM   #15
dolvmin
Member
 
Registered: Jul 2003
Location: Florida
Distribution: Red Hat 7.2/8/9, Fedora Core 1/2/3, Smoothwall, Mandrake 7.0/10, Vecter 4, Arch 0.6, EnGuarde
Posts: 289

Original Poster
Rep: Reputation: 30
I been working on it since this morning. I'm going to take a break, then try your idea's out. Again, I'll report the feed back and thanks for the efforts.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-03-2005 11:00 PM
bash script and grep syros Programming 4 01-13-2005 03:04 PM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 07:38 PM
sed script glam1 Programming 2 08-31-2004 11:28 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration