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

Enabling Clock at User Logon

I had what seemed like a straight forward scenario which turned out quite the opposite, basically I wanted to enable the clock for all of the users logging into a machine.  Great I thought, no problem, just hack in a StuckRects2 Settings registry value which has the clock enabled at logon right? Then, looking closely I really didn’t want to affect other settings such as if the taskbar is always on top, small or large start menu icons are being used etc…  This is when things got interesting because the StuckRects2 Settings value is not exactly readable… So if you […]

Read more

WMI Tasks: Registry by MSFT

WMI tasks for the registry create and modify registry keys and values. For other examples, see the TechNet ScriptCenter at http://www.microsoft.com/technet. The script examples shown in this topic obtain data only from the local computer. For more information about how to use the script to obtain data from remote computers, see Connecting to WMI on a Remote Computer. The following procedure describes how to run a script. To run a script Copy the code and save it in a file with a .vbs extension. Ensure that your text editor does not add a .txt extension to the file. Open a […]

Read more