SED: Pattern Matching Across More than 1 Line

Yes, this is something that a lot of people want to do (whether they realise it or not) as the s/pattern1/replacement/ does not work if the string spans more than one line. Example Suppose we want to replace every instance of Microsoft Windows 95 with Linux (I mean, just replace the text !). Our first attempt is this: s/Microsoft Windows 95/Linux/g Unfortunately, the script fails if our file looks like this: Microsoft Windows 95 Since neither line matches the pattern microsoft Windows 95 So we need to do better. We need the "multiline next" or N command. The next command […]

Read more

LANDesk: Scheduled Task Script to Run an Hourly Script

LANDesk Script: [MACHINES] REMEXEC0=<qt/>%LDMS_CLIENT_DIR%LocalSch.exe<qt/> /del /range=%quote%1001|2000%quote% REMEXEC1001=<qt/>%LDMS_CLIENT_DIR%LocalSch.exe<qt/> /exe=%quote%C:Toolsbinhstart.exe /NOCONSOLE%quote% /cmd=<qt/>""perl C:PerlSiteLibRun-Inventory-Win7.pl -P -D""<qt/> /taskid=1001 /freq=600 /start=%quote%27 Jan 1990 01:54:31%quote% Explanation: LINE#1 The REMEXEC0 command deletes any of the LD Scheduled Tasks with id’s ranging between 1001 to 2000. This is to ensure that your command in next line will get proper task id. Doesn’t make any difference as long as /taskid is there and there are no tasks with ID that falls under the specified range. LINE#2 The REMEXEC1001 command runs the Perl script in as a hidden process with LD task id as 1001 and runs at the top […]

Read more

Run Method (Windows Script Host)

  Runs a program in a new process. Copy object .Run(strCommand, [intWindowStyle], [bWaitOnReturn]) Arguments object WshShell object. strCommand String value indicating the command line you want to run. You must include any parameters you want to pass to the executable file. intWindowStyle Optional. Integer value indicating the appearance of the program’s window. Note that not all programs make use of this information. bWaitOnReturn Optional. Boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run […]

Read more