I love the GridLines feature but want to apply the same .vgrid file to multiple data files.
My data file names are in the form BS-{server-name}-{yyyymmdd}.dta.
Is there a way of using a single .vgrid file for each of these data files or does each data file need a corresponding .vgrid file?
Can I use the same .vgrid file for multiple data files?
Moderator: vuser
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Can I use the same .vgrid file for multiple data files?
Yes. You need to do the following:Is there a way of using a single .vgrid file for each of these data files or does each data file need a corresponding .vgrid file?
Firstly, you need to enable Grid Rules - on the Options submenu of the main GridLines menu.
You then create a .rules file in the "Default Grid Directory". This file must be created manually with an editor.
Each line in this file (.rules) consists of a regular expression followed by a replacement string (separated by a "/").
When viewing a file, V will try to match the file name against each expression in .rules. If it finds a match, it tries to load the .vgrid file specified by the replacement.
If your file names were of the form BS-{server-name}-{yyyymmdd}.dta
you could apply a single .vgrid file by adding the following line to .rules:
Code: Select all
BS.*\.dta/BS.vgrid
Note that the expressions in .rules must be regular expressions - which are different from simple Windows/DOS wildcard expressions (like BS*.dta).
Also, any lines in .rules that begin with either # or ; are ignored (they can be used for comments).
Let me know if you have any problems.
Regards,
Charles.