Nice approach indeed!
Could be curtailed to
, including the item list file as well.
I went with this method inserted into a script. It worked well (and very quickly) the first time I tried it, but there was no output the second time. I will have to investigate what I did there.
I also made a second try before there were any responses here. This ended up looking more like the code posted by MadeInGermany where I read in the file to be modified and stored it in an array. I then did a double loop with the outside loop being my list file and the inside loop being the array with the file to be modified. Each item in the list was searched against the lines in the array. If a match was found, the array element was modified to remove the comment and then there was a break in the inner loop. The modified array was printed at the end. This approach means that each file is read in once and the output was written once, instead of once for each list item.
It seems to me that sed must be doing more or less the same thing under the hood. Every list item must be checked against every item in the file to be modified, at least until a match is found. I wasn't able to rationalize if it was more efficient to have one or the other file be the inner loop. The only approach I could think of that would be faster would be to identify the 'Gmax" value on each line of the file to be modified and then loop up that value in a map holding the list. That would, however, involve much more significant parsing of the lines to extract the 'Gmax' value. It is very nice to have a glob match, especially when there isn't a clear and consistent delimiter. If the list was the inner loop, you could delete each array element when a match was found and thus shorten the search as the process continues but deleting and shifting around array elements also takes resources.
Does anyone know what sed is doing to achieve the result so quickly? Is it mainly that is is using compiled code?
I have a dropdown menu built in perl tk (I am using active state perl). I want to select a value from the dropdown menu and I want to be able to perform some other actions depending upon what value is selected. I have all the graphical part made but I dont know how to get the selected value. Any... (0 Replies)
Requirement is:
1. comment and uncomment the line with Shell
Script: /opt/admin/fastpg/bin/fastpg.exe -c -=NET (using fastpg.exe as a search option)
2. display = "Commented" (when its commented) and display = "Uncommented" (when its uncommented)
Its urgent, please let me asap!!!
Thanks in... (2 Replies)
Hi,
I've a list in the following format:
Empdept filedetails buildingNo Area
AAA 444 2 juy
AAA 544 2 kui
AAA 567 4 poi
AAA 734 5 oiu
AAA 444 ... (2 Replies)
I have a combo.cgi here. this is linux environment
What i am going to do is this combobox will list down all the flatfile name in this /u/test/cgi-bin/List directory.
after that, i wanted it to open the flatfile and display the content of the flatfile into another listbox or textarea in this page... (0 Replies)
Hi,
I have the following lines that I would like to see in an array for easy comparisons and printing:
Example 1:
field1,field2,field3,field4,field5
value1,value2,value3,value4,value5Example 2:
field1,field3,field4,field2,field5,field6,field7... (7 Replies)
Hi All,
Need a small help in writing a shell script which can delete a few lines from a file which is currently being used by another process.
File gets appended using tee -a command due to which its size is getting increased.
Contents like :
25/09/2012 05:18 Run ID:56579677-1
My... (3 Replies)
cd path
line1
line2
line3
line4
line5
Lets say thats the sample script...So say if i have to comment the above script, which would be the better way so that whenever i want, i cud comment or uncomment the same.
Thanks (1 Reply)
I have one master file "File1" with all such info in it. I need to grep each object under each list from another file "File2". Can anyone help me with a script for this.
File 1
------
List 1
Object 1
Object 2
List 2
Object 3
Object 1
List 3
Object 2
... (5 Replies)
Hello,
I have some tab delimited text data,
file: final_temp1
aname val
NAME;r'(1,) 3.28584
r'(2,)<tab>
NAME;r'(3,) 6.13003
NAME;r'(4,) 4.18037
r'(5,)<tab>
You can see that the data is incomplete in some cases. There is a trailing tab after the first column for each incomplete row. I... (2 Replies)
Hello,
I need to collect some statistical results from a series of files that are being generated by other software. The files are tab delimited. There are 4 different sets of statistics in each file where there is a line indicating what the statistic set is, followed by 5 lines of values. It... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
LEARN ABOUT FREEBSD
rcorder
RCORDER(8) BSD System Manager's Manual RCORDER(8)NAME
rcorder -- print a dependency ordering of interdependent files
SYNOPSIS
rcorder [-k keep] [-s skip] file ...
DESCRIPTION
The rcorder utility is designed to print out a dependency ordering of a set of interdependent files. Typically it is used to find an execu-
tion sequence for a set of shell scripts in which certain files must be executed before others.
Each file passed to rcorder must be annotated with special lines (which look like comments to the shell) which indicate the dependencies the
files have upon certain points in the sequence, known as ``conditions'', and which indicate, for each file, which ``conditions'' may be
expected to be filled by that file.
Within each file, a block containing a series of ``REQUIRE'', ``PROVIDE'', ``BEFORE'' and ``KEYWORD'' lines must appear. The format of the
lines is rigid. Each line must begin with a single '#', followed by a single space, followed by ``PROVIDE:'', ``REQUIRE:'', ``BEFORE:'', or
``KEYWORD:''. No deviation is permitted. Each dependency line is then followed by a series of conditions, separated by whitespace. Multi-
ple ``PROVIDE'', ``REQUIRE'', ``BEFORE'' and ``KEYWORD'' lines may appear, but all such lines must appear in a sequence without any interven-
ing lines, as once a line that does not follow the format is reached, parsing stops.
The options are as follows:
-k Add the specified keyword to the ``keep list''. If any -k option is given, only those files containing the matching keyword are
listed.
-s Add the specified keyword to the ``skip list''. If any -s option is given, files containing the matching keyword are not listed.
An example block follows:
# REQUIRE: networking syslog
# REQUIRE: usr
# PROVIDE: dns nscd
This block states that the file in which it appears depends upon the ``networking'', ``syslog'', and ``usr'' conditions, and provides the
``dns'' and ``nscd'' conditions.
A file may contain zero ``PROVIDE'' lines, in which case it provides no conditions, and may contain zero ``REQUIRE'' lines, in which case it
has no dependencies. There must be at least one file with no dependencies in the set of arguments passed to rcorder in order for it to find
a starting place in the dependency ordering.
DIAGNOSTICS
The rcorder utility may print one of the following error messages and exit with a non-zero status if it encounters an error while processing
the file list.
Requirement %s has no providers, aborting. No file has a ``PROVIDE'' line corresponding to a condition present in a ``REQUIRE'' line in
another file.
Circular dependency on provision %s, aborting. A set of files has a circular dependency which was detected while processing the stated con-
dition.
Circular dependency on file %s, aborting. A set of files has a circular dependency which was detected while processing the stated file.
SEE ALSO rc(8)HISTORY
The rcorder utility first appeared in NetBSD 1.5.
AUTHORS
Written by Perry E. Metzger <perry@piermont.com> and Matthew R. Green <mrg@eterna.com.au>.
BUGS
The ``REQUIRE'' keyword is misleading: It doesn't describe which daemons have to be running before a script will be started. It describes
which scripts must be placed before it in the dependency ordering. For example, if your script has a ``REQUIRE'' on ``named'', it means the
script must be placed after the ``named'' script in the dependency ordering, not necessarily that it requires named(8) to be started or
enabled.
BSD August 5, 2011 BSD