I am searching for multiple files in total linux server using shell script, But find command generally searches for the entire server for the files.
which is taking more time for searching. is there any way we can write shell script where it needs to search for multiple files. if any of the file matching with search it needs to stop searching again for it.
Example : I am looking for a1 r3 y7 files in the entire server.
If i use find syntax like below
so will it search for "a1" file in entire server and then starts looking for "r3" ?
will it search for multiple files at a time ?.
Moderator's Comments:
Please use code tags when posting data and code samples!
Last edited by Chubler_XL; 02-20-2020 at 09:55 PM..
Hi all,
In the process of creating CPU reports.
I've already used `sar` to create a daily file, then monthly reports for CPU usage (which is averaged across all 4 CPU's).
I've now used `cpusar -P ?`(?=CPU#) to collect individual CPU data and have four files for each day which is great.
The... (4 Replies)
Is there any better way of doing this? I only want to find a status of a diff, ie diff the file and return to me whether it is different or not or non-existant.
This example works, however I think it could be less messier:
workd=`pwd`;find $workd -name "*.sum" | while read line ; do... (1 Reply)
Hi!
Can someone explain me exactly this technique? Why a process (PARENT) creates a copy of itself with FORK (CHILD)? What's the reason of this behaviour? Sorry, but I cannot understand the logic behind it.
Thanks. (4 Replies)
Hi,
I am having a problem running multiple commands in a autosys command line. For example I would like to run a perl script first and then add sleep command after that in the same autosys job like below
insert_job: xxxxxxxxx
command: `perlscript.pl ; sleep 180`
Perlscript.pl... (0 Replies)
I have a snippet file with the shown below:
data file
1 2
1 3
1 3
4 2
3 2
2 1
2 2
5 1
3 2
3 2
2 3
1 4
Actual file has approx 50 Millions such lines with bigger number (9 Replies)
Hi,
We have a unix shell script which tries login to database. The user name and password to connect to database is stored in a file connection.sql.
Now connection.sql has contents
def ora_user =&1
CONNECT A_PROXY/abc123@DEV01
When on UNIX server we connect to database and set spool on... (7 Replies)
Hi all,
I am working on a sample backup code, where i read the files per 7200 bytes and send it to server. Before sending to server, i compress each 7200 bytes using zlib compression algorithm using dictionary max length of 1.5 MB . I find zlib is slow.
Can anyone recommend me a... (3 Replies)
Hi,
I wrote a simple script, which will call other scripts or run commands on a UNIX server. my script has multiple steps/commands with some delay in between.
I usually get some email notifications after the successful execution of each step.
**My intention is to get email alerts when it is... (5 Replies)
Discussion started by: System Admin 77
5 Replies
LEARN ABOUT XFREE86
script
SCRIPT(1) User Commands SCRIPT(1)NAME
script - make typescript of terminal session
SYNOPSIS
script [options] [file]
DESCRIPTION
script makes a typescript of everything displayed on your terminal. It is useful for students who need a hardcopy record of an interactive
session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves the dialogue in this file. If no filename is given, the dialogue is saved in the file type-
script.
OPTIONS -a, --append
Append the output to file or to typescript, retaining the prior contents.
-c, --command command
Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves
differently when its stdout is not a tty.
-e, --return
Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n.
-f, --flush
Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can
supervise real-time what is being done using `cat foo'.
--force
Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic
link.
-q, --quiet
Be quiet (do not write start and done messages to standard output).
-t[file], --timing[=file]
Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field
indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time.
This information can be used to replay typescripts with realistic typing and output delays.
-V, --version
Display version information and exit.
-h, --help
Display help text and exit.
NOTES
The script ends when the forked shell exits (a control-D for the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not
set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate
the screen, the results are meant to emulate a hardcopy terminal.
It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to
unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for
example the .profile file, which is read by login shells only:
if test -t 0 ; then
script
exit
fi
You should also avoid use of script in command pipes, as script can read more input than you would expect.
ENVIRONMENT
The following environment variable is utilized by script:
SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed.
(Most shells set this variable automatically).
SEE ALSO csh(1) (for the history mechanism), scriptreplay(1)HISTORY
The script command appeared in 3.0BSD.
BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the
session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See
the NOTES section for more information.
AVAILABILITY
The script command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils
/util-linux/>.
util-linux June 2014 SCRIPT(1)