Sponsored Content
Top Forums Shell Programming and Scripting UNIX Shell Scripting (Solaris) for File Checking Post 302974484 by RudiC on Tuesday 31st of May 2016 05:42:59 AM
Old 05-31-2016
So, where do we start? Being an electronics engineer, is the assumption correct that you know what a specification is? Loosely phrased, the description of a target (contents, shape, structure, timing) and the collection of basic data (setup, sample input, ...) to start from, constraints and/or exceptions and/or boundary conditions, tools available (or forbidden), sometimes accompanied by ideas or even rules/instructions on how to get there.
Still online? Let's start with

The target: Paraphrased from your post#1: A list of directories with the information "contains valid/invalid files". Please refine to taste.

The basics: A number of subdirectories in your home directory (definition varies in above posts) with files to be searched for keywords. Please be very aware that we don't know anything about your computer/(file-) system/directory structure/anything. So some samples might help!
Additional info needed:
- What flexibiltiy is required?
- Do the subdirs change a lot?
- Are there more subdirs?
- - How to define the interesting ones?
- - How to exclude the others?
- - Use a "white list" (= config file)?
- Do the keywords change?
- - How to provide?
- - Are there more than one keyword per subdir?

- config files to be used?
- - one? many?
- - structure of the config file(s)
- - up to the service provider?

Constraints/exceptions/boundary conditions:
- not (yet) known

The tools: available *nix commands/versions (your Solaris have may some restrictions that other OS don't have)
- pure shell (which do you use?)
- text processing commands (sed, awk, perl, ...)
- up to the service provider?



I'll stop here with this non-exhaustive list. Feel free to complete and answer.


You now may say: "What an immense effort for a minor task like a mere 'file list for 7 directories' ". I'd request you to ponder the overall time it took for the two of us to type posts #1 to #10 compared to you making up your mind and put together a small set of basic data, stringent rules, and a precise, distinct result, with which a satisfactory solution would have been proposed within hours if not minutes.

I'd propose you take a step back and try to rephrase your request considering at least part of above...

Last edited by RudiC; 05-31-2016 at 06:52 AM..
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

2. AIX

Unix shell scripting to find latest file having timestamp embedded...

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

How to check the file existence using shell scripting in Solaris-10

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

Unix Shell Scripting -- update employees not present in input file

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

C Shell Scripting - HELP! - checking total args in a script

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

generate tabular output from an input text file in unix shell 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

Request for file read option in Unix shell 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

How to add trailer record at the end of the flat file in the unix ksh shell 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

Read csv file, convert the data and make one text file in UNIX shell 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

Solaris Shell Scripting

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
SYSTEMD-TMPFILES(8)						 systemd-tmpfiles					       SYSTEMD-TMPFILES(8)

NAME
systemd-tmpfiles, systemd-tmpfiles-setup.service, systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service, systemd-tmpfiles- clean.timer - Creates, deletes and cleans up volatile and temporary files and directories SYNOPSIS
systemd-tmpfiles [OPTIONS...] [CONFIGFILE...] System units: systemd-tmpfiles-setup.service systemd-tmpfiles-setup-dev.service systemd-tmpfiles-clean.service systemd-tmpfiles-clean.timer User units: systemd-tmpfiles-setup.service systemd-tmpfiles-clean.service systemd-tmpfiles-clean.timer DESCRIPTION
systemd-tmpfiles creates, deletes, and cleans up volatile and temporary files and directories, based on the configuration file format and location specified in tmpfiles.d(5). If invoked with no arguments, it applies all directives from all configuration files. If one or more absolute filenames are passed on the command line, only the directives in these files are applied. If "-" is specified instead of a filename, directives are read from standard input. If only the basename of a configuration file is specified, all configuration directories as specified in tmpfiles.d(5) are searched for a matching file. OPTIONS
The following options are understood: --create If this option is passed, all files and directories marked with f, F, w, d, D, v, p, L, c, b, m in the configuration files are created or written to. Files and directories marked with z, Z, t, T, a, and A have their ownership, access mode and security labels set. --clean If this option is passed, all files and directories with an age parameter configured will be cleaned up. --remove If this option is passed, the contents of directories marked with D or R, and files or directories themselves marked with r or R are removed. --user Execute "user" configuration, i.e. tmpfiles.d files in user configuration directories. --boot Also execute lines with an exclamation mark. --prefix=path Only apply rules with paths that start with the specified prefix. This option can be specified multiple times. --exclude-prefix=path Ignore rules with paths that start with the specified prefix. This option can be specified multiple times. --root=root Takes a directory path as an argument. All paths will be prefixed with the given alternate root path, including config search paths. Note that this option does not alter how the users and groups specified in the configuration files are resolved. With or without this option, users and groups are always resolved according to the host's user and group databases, any such databases stored under the specified root directories are not consulted. -h, --help Print a short help text and exit. --version Print a short version string and exit. It is possible to combine --create, --clean, and --remove in one invocation. For example, during boot the following command line is executed to ensure that all temporary and volatile directories are removed and created according to the configuration file: systemd-tmpfiles --remove --create UNPRIVILEGED --CLEANUP OPERATION systemd-tmpfiles tries to avoid changing the access and modification times on the directories it accesses, which requires CAP_ADMIN privileges. When running as non-root, directories which are checked for files to clean up will have their access time bumped, which might prevent their cleanup. EXIT STATUS
On success, 0 is returned. If the configuration was invalid (invalid syntax, missing arguments, ...), so some lines had to be ignored, but no other errors occurred, 65 is returned (EX_DATAERR from /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from /usr/include/stdlib.h). SEE ALSO
systemd(1), tmpfiles.d(5) systemd 237 SYSTEMD-TMPFILES(8)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy