Sponsored Content
Top Forums Shell Programming and Scripting Recursively cat files in a directory with filename printed first. Post 302719289 by lewk on Monday 22nd of October 2012 10:44:26 AM
Old 10-22-2012
Noted, thank you for this this.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Recursively copy only specific files from a directory tree

Hi I am a shell-script newbie and am looking to synchronize certain files in two directory structures. Both these directory-trees are in CVS and so I dont want the CVS directory to be copied over. I want only .sh and .pl files in each subdirectory under these directory trees to be... (3 Replies)
Discussion started by: sharpsharkrocks
3 Replies

2. Shell Programming and Scripting

delete files recursively in the specified directory

I have to write a shell script which can delete all the files and directories recursively inside the specified directory but should not delete the specified directory. Please some body help me in writing the script. (3 Replies)
Discussion started by: deepthi.s
3 Replies

3. UNIX for Dummies Questions & Answers

cat files from subdirectories output using same filename

Hi, I need to concatenate data files with a .mp extension that are stored in directories by year. I want to keep the same filename as an output for example: for the file name p030.mp, which resides in the following subdirectories: /2000/p030.mp /2001/p030.mp /2002/p030.mp I want to:... (4 Replies)
Discussion started by: cmshreve
4 Replies

4. Shell Programming and Scripting

Problem with script generating files in directory recursively

I have a script which generates recursively some files in folders for a given root folder. I have checks for permissions and it works for all folders except one(i have 777 permission on it). When i try calling the script in problematic folder(problematic folder being root folder), script works as... (2 Replies)
Discussion started by: bb2
2 Replies

5. Solaris

Display the number of files in a directory and recursively in each subdirectory

Display the number of files in a directory and recursively in each subdirectory To look something like below, for example /var 35 /var/tmp 56 /var/adm 46Any ideas how can we do this? Got a sun cluser global mount point which takes ages to mount everytime, need to understand... (5 Replies)
Discussion started by: jakerock
5 Replies

6. Shell Programming and Scripting

Cat files listed in text file and redirect to new directory with same filename

I have a directory that is restricted and I cannot just copy the files need, but I can cat them and redirect them to a new directory. The files all have the date listed in them. If I perform a long listing and grep for the date (150620) I can redirect that output to a text file. Now I need to... (5 Replies)
Discussion started by: trigger467
5 Replies

7. UNIX for Dummies Questions & Answers

Find all files containing string not following symlinks CAT (modified) output content to /filename

This should recursively walk through all dirictories and search for a specified string in all present files, if found output manicured content (eg some regex) with CAT into a specified directory (eg /tmp/) one by one, keeping the original names This is what I have so far, which seems to... (1 Reply)
Discussion started by: lowmaster
1 Replies

8. Shell Programming and Scripting

How to recursively copy directory only for recent files?

I love the -newerct flag for the Cygwin find command on windows. Can I use "/usr/bin/find . -newerct '3 hours ago'" to conditionally copy a directory tree so that only the files in the directory tree that are younger than 3 hours are copied to my destination directory such that the directory... (4 Replies)
Discussion started by: siegfried
4 Replies

9. Shell Programming and Scripting

Find Large Files Recursively From Specific Directory

Hi. I found many scripts in the web of achieving this. But I like to use this one find /EDWH-DMT03 -xdev -size +10000 -exec ls -la {} \;|sort -n -k 5 > LARGE.rst But the problem is, why it still list out files with 89 bytes as the output? Is there anything wrong with the command? My... (7 Replies)
Discussion started by: aimy
7 Replies

10. Shell Programming and Scripting

Copy files recursively to one single directory

I need to copy a complete directory structure into a new location. But I want to have all files copied into one directory and leave out the directory structure. So all files must be placed in one directory. (4 Replies)
Discussion started by: ReneVL
4 Replies
NOTIFY(2)							System Calls Manual							 NOTIFY(2)

NAME
notify, noted, atnotify - handle asynchronous process notification SYNOPSIS
#include <u.h> #include <libc.h> int notify(void (*f)(void*, char*)) int noted(int v) int atnotify(int (*f)(void*, char*), int in) DESCRIPTION
When a process raises an exceptional condition such as dividing by zero or writing on a closed pipe, a note is posted to communicate the exception. A note may also be posted by a write(see read(2)) to the process's /proc/n/note file or to the /proc/m/notepg file of a process in the same process group (see proc(3)). When the note is received the behavior of the process depends on the origin of the note. If the note was posted by an external process, the process receiving the note exits; if generated by the system the note string, preceded by the name and id of the process and the string "suicide: ", is printed on the process's standard error file and the process is suspended in the Broken state for debugging. These default actions may be overridden. The notify function registers a notification handler to be called within the process when a note is received. The argument to notify replaces the previous handler, if any. An argument of zero cancels a previous handler, restoring the default action. A fork(2) system call leaves the handler registered in both the parent and the child; exec(2) restores the default behav- ior. After a note is posted, the handler is called with two arguments: the first is a pointer to a Ureg structure (defined in /$obj- type/include/ureg.h) giving the current values of registers; the second is a pointer to the note itself, a null-terminated string with no more than characters in it including the terminal NUL. The Ureg argument is usually not needed; it is provided to help recover from traps such as floating point exceptions. Its use and layout are machine- and system-specific. A notification handler must finish either by exiting the program or by calling noted; if the handler returns the behavior is undefined and probably erroneous. Until the program calls noted, any further externally-generated notes (e.g. hangup or alarm) will be held off, and any further notes generated by erroneous behavior by the program (such as divide by zero) will kill the program. The argument to noted defines the action to take: NDFLT instructs the system to perform the default action as if the handler had never been registered; NCONT instructs the system to resume the process at the point it was notified. In neither case does noted return to the handler. If the note interrupted an incomplete system call, that call returns an error (with error string interrupted) after the process resumes. A notifica- tion handler can also jump out to an environment set up with setjmp using the notejmp function (see setjmp(2)), which is implemented by modifying the saved state and calling noted(NCONT). Regardless of the origin of the note or the presence of a handler, if the process is being debugged (see proc(3)) the arrival of a note puts the process in the Stopped state and awakens the debugger. Rather than using the system calls notify and noted, most programs should use atnotify to register notification handlers. The parameter in is non-zero to register the function f, and zero to cancel registration. A handler must return a non-zero number if the note was recog- nized (and resolved); otherwise it must return zero. When the system posts a note to the process, each handler registered with atnotify is called with arguments as described above until one of the handlers returns non-zero. Then noted is called with argument NCONT. If no reg- istered function returns non-zero, atnotify calls noted with argument NDFLT. Noted has two other possible values for its argument. NSAVE returns from the handler and clears the note, enabling the receipt of another, but does not return to the program. Instead it starts a new handler with the same stack, stack pointer, and arguments as the original, at the address recorded in the program counter of the Ureg structure. Typically, the program counter will be overridden by the first note handler to be the address of a separate function; NSAVE is then a `trampoline' to that handler. That handler may executed noted(NRSTR) to return to the original program, usually after restoring the original program counter. NRSTR is identical to NCONT except that it can only be executed after an NSAVE. NSAVE and NRSTR are designed to improve the emulation of signals by the ANSI C/POSIX environment; their use elsewhere is discouraged. The set of notes a process may receive is system-dependent, but there is a common set that includes: Note Meaning interrupt user interrupt (DEL key) hangup I/O connection closed alarm alarm expired sys: breakpoint breakpoint instruction sys: bad address system call address argument out of range sys: odd address system call address argument unaligned sys: bad sys call system call number out of range sys: odd stack system call user stack unaligned sys: write on closed pipe write on closed pipe sys: fp: fptrap floating point exception sys: trap: trap other exception (see below) The notes prefixed sys: are generated by the operating system. They are suffixed by the user program counter in format pc=0x1234. If the note is due to a floating point exception, just before the pc is the address of the offending instruction in format fppc=0x1234. Notes are limited to ERRLEN bytes; if they would be longer they are truncated but the pc is always reported correctly. The types and syntax of the trap and fptrap portions of the notes are machine-dependent. Alef Because the run-time system does not protect itself, Alef programs require extreme care to recover from notes. Notes are, however, useful for shutting down multi-process programs cleanly. There is no atnotify in Alef. SOURCE
/sys/src/libc/9syscall /sys/src/libc/port/atnotify.c SEE ALSO
intro(2), notejmp in setjmp(2) BUGS
Since exec(2) discards the notification handler, there is a window of vulnerability to notes in a new process. NOTIFY(2)
All times are GMT -4. The time now is 09:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy