Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Need batch script to edit file

- - - - -

  • Please log in to reply
1 reply to this topic

#1
bapu1981

bapu1981
  • Member
  • 1 posts
  • Joined 05-September 12
  • OS:Windows 7 x86
  • Country: Country Flag
Hi,

I need batch script to edit file and restart the service in windows.
For example:

monitor oid memInUseCapacity.0 601 0x00300300 300 absolute > 95 '#3-Low Memory' '' in this i want to add [MID_XXXXX].

To replace :

monitor oid memInUseCapacity.0 601 0x00300300 300 absolute > 95 '#3-Low Memory. [MID_XXXXX]' ''

after that i want to restart one service.

Regards
Bapu


How to remove advertisement from MSFN

#2
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
If you want :
file1:
monitor oid memInUseCapacity.0 601 0x00300300 300 absolute > 95 '#3-Low Memory' ''
to become
file2:
monitor oid memInUseCapacity.0 601 0x00300300 300 absolute > 95 '#3-Low Memory. [MID_XXXXX]' '' 
You could use the mingw port of sed from the unix tools and do the following:
type file1 | sed "s/'/. [MID_XXXXX]'/2" >file2

Edited by allen2, 06 September 2012 - 12:38 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users