01-31-2008
now there you go - that's what a real guru comes up with, and I'm impressed - never even thought of that sneaky solution.
nice piece of code radoulov - I keep learning something new from your posts - you da man.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All,
How to replace a string in nth line of a file using sed or awk.
For Ex: test.txt
Line 1 : TEST1 TEST2 TEST3
Line 2 : TEST1 TEST2 TEST3 TEST4
Line 3 : TEST1 TEST2 TEST3 TEST5
Line 4 : TEST1 TEST2 TEST3 TEST6
Line 5 : TEST1 TEST2 TEST3 TEST7
i want to go to 4th line of a... (1 Reply)
Discussion started by: maxmave
1 Replies
2. UNIX for Dummies Questions & Answers
I have several files (around 50) that have the similar format. I need to extract the 5th line from every file and output that into a text file. So far, I have been able to figure out how to do it for a single file:
$ awk 'NR==5' text1.txt > results.txt
OR
$ sed -n '5p' text1.txt > results.txt... (6 Replies)
Discussion started by: oriqin
6 Replies
3. Shell Programming and Scripting
Hi all,
assume that i am having the following line in a file called file1.
triumph and disaster must be treated same.
I want to replace this line with.
follow excellence success will chase you.
is it possible to do this using sed. if possible kindly post me the... (2 Replies)
Discussion started by: anishkumarv
2 Replies
4. Shell Programming and Scripting
Hi
I have requirement to find nth occurrence in a file and capture data from with in lines (between lines)
Data in File.
<QUOTE>
<SESSION>
<ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/>
<ATTRIBUTE NAME='Service Name' VALUE='None'/>
</SESSION>
<SESSION>
<ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies
5. Shell Programming and Scripting
There is already one thread with the same heading. But here the case is little different.
i have a line which have a field separator '|'
abc|def|ghi|jkl|mno|pqr|stu|vwx|yz
I want to replace every 3rd occurance + next character with the same + newline character.. I mean i want to enter a... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies
6. Shell Programming and Scripting
Greetings experts. Searched the forums (perhaps not hard enough?) - Am searching for a method to capture all output from a log file following the nth occurrence of a known string.
Background:
Using bash, I want to monitor my Oracle DB alert log file. The script will count the total # of... (2 Replies)
Discussion started by: cjtravis
2 Replies
7. Shell Programming and Scripting
Hi,
I am getting crazy after days on looking at it:
Bash in Ubuntu 12.04.1
I want to do this:
pattern="system /path1/file1 file1"
new_pattern=" data /path2/file2 file2"
file to edit: data.db
- I need to search in the file data.db for the nth occurrence of pattern
- pattern must... (14 Replies)
Discussion started by: Phil3759
14 Replies
8. Shell Programming and Scripting
Please can someone help with this?
I have a file with lines as follows:
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
word1 word2 word3 word4 word5 word6 word7 word8
When I use the... (7 Replies)
Discussion started by: Subhadeep_Sahu
7 Replies
9. Shell Programming and Scripting
Hi All,
I am very new to shell scripting and tried to search this in the forum but no luck.
Requirment:
I have an input file which is comma separated. I need to replace the value in 4th column with another value. This has to happen for all the lines in the file.
Sample data:
Input... (2 Replies)
Discussion started by: arunkumarsd
2 Replies
10. Shell Programming and Scripting
Hello,
Below command trims right after the nth occurrence of a string.
When I try in while loop, it is not working.
In Terminal
IFS=/ ; read -ra val < Textfile ; echo "${val:0:3}"
It gives only one line:
sunday/monday/tuesday
Textfile:
sunday/monday/tuesday/wednesday/thursday... (2 Replies)
Discussion started by: baris35
2 Replies
LEARN ABOUT HPUX
pthread_set_nice_np
pthread_get_nice_np(3T) pthread_get_nice_np(3T)
NAME
pthread_get_nice_np(), pthread_set_nice_np() - get or set the nice value of a thread
SYNOPSIS
PARAMETERS
thread The thread whose nice value is to be set/retrieved.
nice_val Value of nice to be applied to the target thread is returned (get function) or it specifies the new value of nice for
thread (set function).
DESCRIPTION
These functions are used to set and retrieve the nice value of an individual thread.
returns the current nice value setting of the target thread and stores it in nice_val. adds the value of nice_val to the current nice
value of the target thread.
A thread's nice value is a non-negative number. The system imposes a minimum nice value of 0 and a maximum of 39 with lower nice values
providing more favorable scheduling. If calling results in a nice value outside the range of 0 to 39, the value will be set to the nearest
limit. A process must have appropriate privileges to lower a thread's nice value. The function allows individual threads in the process
to have different nice values.
returns the current nice value less 20 and will be in the range -20 to +19.
The nice value of only system scope threads can be changed. An attempt to change the nice value of a process-scope thread will result in a
return value of Calling on a thread that has a scheduling policy other than will have an effect only when the thread's scheduling policy
changes to If a thread calls the system call to create a new process, the new process inherits the process-level nice value. Calling to
create a new thread will result in the new thread inheriting the creating thread's nice value.
Note
If the nice value of the entire process is changed through or all the threads in the process will have their nice values reset to the new
process-level nice value. The new process's nice value setting overwrites the old thread's setting. Thus its possible that a thread whose
nice value had been set higher than the process-level nice value have its nice value lowered as a result of the process-level re-nicing.
RETURN VALUE
Upon successful completion, and return zero.
Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the and functions return the corresponding error:
A process-scope thread was specified.
The caller does not have permission to lower the nice
value specified in nice_val.
No thread could be found corresponding to
thread.
AUTHOR
and were developed by HP.
SEE ALSO
fork(2), nice(2), setpriority(2), pthread_attr_getschedpolicy(3T), pthread_setschedparam(3T).
Pthread Library pthread_get_nice_np(3T)