There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Batch Stripping


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Zalio's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2004
Experience: Advanced
24-Jul-2004, 05:12 PM #1
Batch Stripping
hello..

im having here the IPlogs of a server, and i have made an stripper for it in batch. What it now does is stripping the time and date, the local ip address and is does sort it all in alphabetic order. My next try is to exclude the ports from the ips. The server does put them in this order: ip.port so: 1.2.3.4.80 as an example of ip 1.2.3.4 using the http port. I cant work with the 1.2.3.4.80 etc values and im looking how i can strip everything behind behind the last dot '.'. Anyone an idea of how i could do this?

Greetz, Zalio
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
24-Jul-2004, 06:16 PM #2
Welcome to TSG!

It would help if you mentioned the language you're working with; since you mention a "batch script", I'll assume you're using bash or similar shell. Here's one way to do it (although far from the most elegant):

Code:
FILENAME=1.2.3.80
NEWFILENAME=`echo $FILENAME | tr '.' ' ' | awk '{ printf "%s.%s.%s\n", $1, $2, $3 }'`
echo newfilename is $NEWFILENAME
Hope this helps.
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
24-Jul-2004, 06:21 PM #3
Oops! -- Now this is embarrassing! Forgot which forum I was posting in (too many open windows, I guess!). Anyway, feel free to disregard that last wild pitch ...
Zalio's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2004
Experience: Advanced
26-Jul-2004, 10:32 AM #4
hehe, sorry for that little mistake.. with batch i mean Windows Win32/DOS scripting. Im not at home now, but my script is like:

-------
@echo off
for /f "eol; something" %%i in (source.txt) do echo %%i>>destination.txt
goto nextthing

:nextthing
echo hehe
-----

and then the same question, if you still can help me would be pleasant!
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:10 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.