At work, we use a software development product (from a company that will remain nameless, but whose name may be considered a synonym for "logical"). The development trees are organized beneath a top directory, let's call it "$rat". The first level under $rat contains the major system names, and at that level there is either the list of subsystems or one additional directory layer then subsystems. I.e., using .1 for subsystems,
Beneath each subsystem, each there are copies of the views for each developer interested in developing there as well as the baselined views of the software. I.e., using .2 for the views,
So fred, barney and wilma do protective skeletal development, while fred, barney and betty do support skeletal development.
Here's the question: Is there a way to write a single "find" expression that will find, for every system, all the source code in betty's view, or (if betty doesn't have a view on the given code) all the source in the baseline view?
The best I've been able to come up with is a two level find:
There are a few more clauses in both find commands to reject "logical's" tool-maintaintained directories.
findbetty is a script that does this:
I.e., if in the given subsystem ".1" directory, there is a "betty.2", print it, otherwise if there is a "baseline.2", print that.
I'd like to be able to do this in a single "find" command with no calls to external programs.
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
For more complex shell scripts, I suggest you use either PHP or PERL. You will have much more overall flexibility and capability. After using these more advanced shell, I rarely do anything in older shells anymore, except very simple scripts (and even the more simple scripts are fun in PHP and PERL).
Originally posted by Neo
For more complex shell scripts, I suggest you use either PHP or PERL. You will have much more overall flexibility and capability. After using these more advanced shell, I rarely do anything in older shells anymore, except very simple scripts (and even the more simple scripts are fun in PHP and PERL).
Six months ago, I would have written this in Perl or Ruby. But if you look at the part that does the work, it's only 4 lines long --- 8 if you count the subservient ls/awk script --- which doesn't qualify as "more complex" in my mind. I guess I could use find2perl to prototype the Perl expressions I'm interested in, though ISTR you take about a 20% performance hit by going through Perl (not a big deal here).
FWIW, I save the output from this program, then from vi I execute another script that picks out the source file I want and prints its full path, as in
It took me a while to understand what the vi intro doc meant when it said that arguments to ":e" are passed to the shell for expansion before trying to edit the file. But I think I've got it now ...
HI Guys ,
Below are the two columns ITEMS and STATE of table .
ITEMS STATE
'2345','ggdh','k5tg','dgyt','hFF' DF
'1234','ghyt','DDD','GHTD','ABF' PQ
Can we get output in PL/SQL in below way ?... (7 Replies)
Hi,
We used to use the below commands often.
ps -ef|grep bc
ps -ef|grep abc|grep -v grep
Both fairly returns the same result.
For example, the process name is dynamic and we are having the process name in a variable, how we can apply the above trick.
For example "a" is the... (11 Replies)
Hello, I find a trick to avoid pressing ESC without key-maping in vim. I am pleasure using this method, because ALT key is very comfortble for thumb to press.
What's the trick? the ALT key.
When you are in INSERT mod, press
ALT+l switch to COMMAND mod without... (2 Replies)
Hi Guys,
I have a script that I am using to convert some text files to xls files. I create multiple temp. files in the process of conversion. Other than reducing the temp. files, are there any general tricks to help speed up the script?
I am running it in the bash shell.
Thanks. (6 Replies)
I issue
find . -name "file.sh"
I get tons of find: cannot read dir
how do I filter out the errors and just get back tbhe results of the search? (1 Reply)
Hello All,
I am getting error while passing a folder name that has space to the cmd line argument.
sh log_delete2.sh "/home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A RM"
log_delete2.sh: line 17: cd: /home/kumarpua/TESTARTIFACTS/atf-chix/ATF-subversion-dev/ssenglogs/A:... (3 Replies)