11-30-2010
What a great way of handling a file!
It does works, but I am really puzzled how shell deals with file handlers, so rm deletes the file, but it somehow exists for the awk process? It would be very interesting if someone can explain
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I need to append some text @ end of the first line in a file.
like
myfile.txt
list = a,b,c
list.a=some..
I give the arg "d" . now it append at end of first line
list=a,b,c,d
list.a=some...
Please help me out this (7 Replies)
Discussion started by: catgovind
7 Replies
2. Shell Programming and Scripting
Hi,
I want to get a Line count of a file and append that at the end of the file. The Line count should not include the Headers :
------------------
COL1,COL2,COL3
123,abc,011
111,abd,0212
Record Count: 2
-------------------
Thanks. (7 Replies)
Discussion started by: smc3
7 Replies
3. Shell Programming and Scripting
Hello forum,
I need help with a script for displaying the number of instances/times a particular line appears in a tab-delimited file and append that number to the end of the line.
Example text file:
aaa bbb ccc ddd
ggg hhh kkk nnn
aaa bbb ccc ddd
aaa bbb ccc ddd
ppp qqq nnn sss
ggg... (1 Reply)
Discussion started by: jaysean
1 Replies
4. Shell Programming and Scripting
I have a file containing about 5 million rows, in the file there are some records which has extra delimiter at random position. (we dont know the positions), now we have to Count the delimeter from each row and if the count of delimeter is not matching then I want to delete those rows from the... (5 Replies)
Discussion started by: Akumar1
5 Replies
5. Shell Programming and Scripting
Say I have a text file like:
1
3
4
How would I use ksh to put the number '2' into the second line of that file? I'm using OpenBSD so the sed syntax might be a bit different (I have no idea how to use sed, though) (4 Replies)
Discussion started by: guitarscn
4 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have 50 text files in a directory called "AllFiles"
I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
Discussion started by: motoxeryz125
7 Replies
7. UNIX for Dummies Questions & Answers
I would like to add a line to the end of a single column text file. How do I go about doing that?
Input:
BEGIN
1
2
3
Output:
BEGIN
1
2
3
END
Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
8. Shell Programming and Scripting
Hi,
I had generated a report in my tool as followsoutput.txt
43.35
9
i needed the script to generate a new file like below
i want to append the text to each of these lines of my filenewoutputfile.txt should be
Total Amount : 43.35
Record Count:9
Regards,
Vasa Saikumar.
... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
9. Shell Programming and Scripting
Hi,
Anyone can help on how to append a file1.txt into file2.txt after line 3 using sed command.
file1.txt
1. testa
2. testb
3. testc
4. testd
5. test5
6. test6
file2.txt
break here
this is a test
break end here
output
1. testa
2. testb (1 Reply)
Discussion started by: fspalero
1 Replies
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT NETBSD
pthread_atfork
PTHREAD_ATFORK(3) BSD Library Functions Manual PTHREAD_ATFORK(3)
NAME
pthread_atfork -- register handlers to be called when process forks
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <pthread.h>
int
pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
DESCRIPTION
The pthread_atfork() function registers the provided handler functions to be called when the fork(2) function is called. Each of the three
handlers is called at a different place in the fork(2) sequence. The prepare handler is called in the parent process before the fork hap-
pens, the parent handler is called in the parent process after the fork has happened, and the child handler is called in the child process
after the fork has happened. The parent and child handlers are called in the order in which they were registered, while the prepare handlers
are called in reverse of the order in which they were registered.
Any of the handlers given may be NULL.
The intended use of pthread_atfork() is to provide a consistent state to a child process from a multithreaded parent process where locks may
be acquired and released asynchronously with respect to the fork(2) call. Each subsystem with locks that are used in a child process should
register handlers with pthread_atfork() that acquires those locks in the prepare handler and releases them in the parent handler.
RETURN VALUES
The pthread_atfork() function returns 0 on success and an error number on failure.
ERRORS
The following error code may be returned:
[ENOMEM] Insufficient memory exists to register the fork handlers.
SEE ALSO
fork(2)
STANDARDS
The pthread_atfork() function conforms to IEEE Std 1003.1c-1995 (``POSIX.1'').
HISTORY
The pthread_atfork() function first appeared in NetBSD 2.0.
CAVEATS
After calling fork(2) from a multithreaded process, it is only safe to call async-signal-safe functions until calling one of the exec(3)
functions. The pthread_*() functions are not async-signal-safe, so it is not safe to use such functions in the child handler.
BUGS
There is no way to unregister a handler registered with pthread_atfork().
BSD
February 12, 2003 BSD