05-30-2016
Not sure if I understood correctly. Let me paraphrase:
You have a handful of directories with some files in each. You want to check if those files have exactly ONE keyword in them, each directory having a different keyword. While the files to be searched are supplied in a config file, one per directory, the keywords are NOT but are constants. Correct?
Some comments upfront:
- *nix differentiates between cases, so apple_DIR does NOT equal APPLE_DIR.
- you can't cat directories (cat $APPLE_DIR) - or is that variable name just misleading?
- with identical code pieces (as shown for the different fruits), loops or subroutines/functions lend themselves for implementation.
Other optimization potential we can discuss once the requirements are clear.
EDIT: And, of course: Please use code tags as required by forum rules!
This User Gave Thanks to RudiC For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
2. AIX
Hi guys,
I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name.
Below is the file format:
filename_yyyymmdd.csv, i need to pick the latest and move it with the... (2 Replies)
Discussion started by: kaushik25
2 Replies
3. Solaris
Hi,
I have a script which will check the fiel existence, the lines are as below
if !(test -d ./data) then
mkdir data
fi
In the first line error occurs as below
generatelicense.sh: syntax error at line 2: `!' unexpected
Where as this script works fine in linux OS.
How to solve... (2 Replies)
Discussion started by: krevathi1912
2 Replies
4. UNIX for Dummies Questions & Answers
ALL,
My shell script takes a employee file as input.
I have to identify the list of employees not in the input file and update their status in the database.
Approach I followed:
by traversing through the input file add all the emplid's to a variable.
update the status of employees not in... (2 Replies)
Discussion started by: sailussr
2 Replies
5. Shell Programming and Scripting
Hi, I 'm trying to learn the scripting language and am trying to create a script to open a C Program, allow the user to edit it, and then run it. What I have works but only when you enter the name to be compiled and the c program, but what if you only entered the 1 argument (cprogram.c) ? but I 'm... (3 Replies)
Discussion started by: patel_ankz
3 Replies
6. Shell Programming and Scripting
Hi,
I have the output (as below) which i want it to be in a table.
For e.g.
space utilization in PSE on path /logs is 0%
space utilization in PSE on path /logs/tuxedo/tuxlsp is 16%
space utilization in PSE on path /ldvarlsp/lsp/log is 37%
space utilization in PSE on path /home is 6%... (7 Replies)
Discussion started by: pkbond
7 Replies
7. Shell Programming and Scripting
Hi Friends,
I would like to read all the record from one txt file to other file txt
For example I have two txt file a.txt and b.txt. I need to read a.txt record by record and I need add the system date @ end of each record before moving it to b.txt. Could you please share the coding for... (4 Replies)
Discussion started by: vinoth124
4 Replies
8. Shell Programming and Scripting
Hi,
How to add trailer record at the end of the flat file in the unix ksh shell scripting
can you please let me know the procedure
Regards
Srikanth (3 Replies)
Discussion started by: srikanth_sagi
3 Replies
9. Shell Programming and Scripting
I have input data looks like this which is a part of a csv file
7,1265,76548,"0102:04"
8,1266,76545,"0112:04"
I need to make the output data should look like this and the output data will be part of text file:
7|1265000 |7654899 |A|
8|12660000 |76545999 |B|
The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies
10. Solaris
Hi,
Want to know, is there any way to restrict a Solaris user to Single Login. Means a particular user can login once and if he or someone else tries to login with his ID then a message displayed "user already logged in" and denies his attempt.
Regard,
Jeet (1 Reply)
Discussion started by: CountJeet
1 Replies
LEARN ABOUT LINUX
manpath
MANPATH(5) /etc/manpath.config MANPATH(5)
NAME
manpath - format of the /etc/manpath.config file
DESCRIPTION
The manpath configuration file is used by the manual page utilities to assess users' manpaths at run time, to indicate which manual page
hierarchies (manpaths) are to be treated as system hierarchies and to assign them directories to be used for storing cat files.
If the environment variable $MANPATH is already set, the information contained within /etc/manpath.config will not override it.
FORMAT
The following field types are currently recognised:
# comment
Blank lines or those beginning with a # will be treated as comments and ignored.
MANDATORY_MANPATH manpath_element
Lines of this form indicate manpaths that every automatically generated $MANPATH should contain. This will typically include
/usr/man.
MANPATH_MAP path_element manpath_element
Lines of this form set up $PATH to $MANPATH mappings. For each path_element found in the user's $PATH, manpath_element will be
added to the $MANPATH.
MANDB_MAP manpath_element [ catpath_element ]
Lines of this form indicate which manpaths are to be treated as system manpaths, and optionally where their cat files should be
stored. This field type is particularly important if man is a setuid program, as (when in the system configuration file /etc/man-
path.config rather than the per-user configuration file .manpath) it indicates which manual page hierarchies to access as the setuid
user and which as the invoking user.
The system manual page hierarchies are usually those stored under /usr such as /usr/man, /usr/local/man and /usr/X11R6/man.
If cat pages from a particular manpath_element are not to be stored or are to be stored in the traditional location, catpath_element
may be omitted.
Traditional cat placement would be impossible for read only mounted manual page hierarchies and because of this it is possible to
specify any valid directory hierarchy for their storage. To observe the Linux FSSTND the keyword `FSSTND can be used in place of an
actual directory.
Unfortunately, it is necessary to specify all system man tree paths, including alternate operating system paths such as /usr/man/sun
and any NLS locale paths such as /usr/man/de_DE.88591.
As the information is parsed line by line in the order written, it is necessary for any manpath that is a sub-hierarchy of another
hierarchy to be listed first, otherwise an incorrect match will be made. An example is that /usr/man/de_DE.88591 must come before
/usr/man.
DEFINE key value
Lines of this form define miscellaneous configuration variables; see the default configuration file for those variables used by the
manual pager utilities. They include default paths to various programs (such as grep and tbl), and default sets of arguments to
those programs.
SECTION section ...
Lines of this form define the order in which manual sections should be searched. If there are no SECTION directives in the configu-
ration file, the default is:
SECTION 1 n l 8 3 0 2 5 4 9 6 7
If multiple SECTION directives are given, their section lists will be concatenated.
If a particular extension is not in this list (say, 1mh) it will be displayed with the rest of the section it belongs to. The
effect of this is that you only need to explicitly list extensions if you want to force a particular order. Sections with exten-
sions should usually be adjacent to their main section (e.g. "1 1mh 8 ...").
SECTIONS is accepted as an alternative name for this directive.
MINCATWIDTH width
If the terminal width is less than width, cat pages will not be created (if missing) or displayed. The default is 80.
MAXCATWIDTH width
If the terminal width is greater than width, cat pages will not be created (if missing) or displayed. The default is 80.
CATWIDTH width
If width is non-zero, cat pages will always be formatted for a terminal of the given width, regardless of the width of the terminal
actually being used. This should generally be within the range set by MINCATWIDTH and MAXCATWIDTH.
NOCACHE
This flag prevents man(1) from creating cat pages automatically.
BUGS
Unless the rules above are followed and observed precisely, the manual pager utilities will not function as desired. The rules are overly
complicated.
2.6.0.2 2011-04-13 MANPATH(5)