Hi,
Could some one help me to get rid of visually blank lines from a file using shell or awk or sed (on Solaris machine)?
When I use grep grep -v ^$ inputfile >outputfile it removes some blank lines.. but it seems some tab plus space balnk lines remains.
thaen I used "grep -v '^]*$' ... (1 Reply)
Hi,
I have a data file with millions of record (N). Each record was saved in 4 lines. So there are total of NX4 lines in the data file.
For Example:
Host1
a
b
c
d
Host2
e
f
g
h
Host3
i
j
k (2 Replies)
Hi
i am writing a cron job. in this script i need to delete some line which is match with some pattern.
following code i written for deletion
sed '1,'$Max_LIneNo' d' myfile.txt >tempfile.tmp
mv tempfile.tmp myfile.txt
this command is working fine but the problem is that after this... (5 Replies)
OK, I am stumpped. I have this shell Script that I want to randomly select a file with the extention of .sct. Then using a portion of its file name select the six related .mot files. Then move them all to another folder. I also need a user input form for the number of .SCT files to randomly select... (6 Replies)
I have a file that needs to be parsed into multiple files every time there line contains a number 1. the problem i face is the lines are random and the file size is random. an example is that on line 4, 65, 187, 202 & 209 are number 1's so there has to be file breaks between all those to create 4... (6 Replies)
How to remove x lines form top and y lines form bottom.
This works, but like awk only cat file | head -n-y | awk 'NR>(x-1)'
so remove last 3 lines and 5 firstcat file | head -n-3 | awk 'NR>4' (5 Replies)
Hello
Could you please help me to find a code that can randomly select 1224 lines from a file of 12240 and make tn output with 1224 line each.
my input is txt file with 12240 lines like :
13474 999003507 0 0 2 -9
13475 999003508 0 0 2 -9
13476 999003509 0 0 1 -9
13477 999003510 0 0 1 -9
... (7 Replies)
Hello friends,
I have a TXT file with 300 lines in it. I need to shuffle all the lines (randomly) so that they get into different order. Can anyone pls provide easy way, if any?
I got it done by doing this below but I see it very lengthy/inefficient way.
call random function to generate... (2 Replies)
Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom.
I create a named pipe then:
dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024
but when I cat a file to the fifo that's 1024 random bytes:
cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies
LEARN ABOUT PHP
getrusage
GETRUSAGE(3) 1 GETRUSAGE(3)getrusage - Gets the current resource usagesSYNOPSIS
array getrusage ([int $who])
DESCRIPTION
This is an interface to getrusage(2). It gets data returned from the system call.
PARAMETERS
o $who
- If $who is 1, getrusage will be called with RUSAGE_CHILDREN.
RETURN VALUES
Returns an associative array containing the data returned from the system call. All entries are accessible by using their documented field
names.
EXAMPLES
Example #1
getrusage(3) example
<?php
$dat = getrusage();
echo $dat["ru_nswap"]; // number of swaps
echo $dat["ru_majflt"]; // number of page faults
echo $dat["ru_utime.tv_sec"]; // user time used (seconds)
echo $dat["ru_utime.tv_usec"]; // user time used (microseconds)
?>
CHANGELOG
+--------+---------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------+
| 7.0.0 | |
| | |
| | This function is now supported on Windows. |
| | |
+--------+---------------------------------------------+
NOTES
Note
On Windows getrusage(3) will only return the following members:
o "ru_stime.tv_sec"
o "ru_stime.tv_usec"
o "ru_utime.tv_sec"
o "ru_utime.tv_usec"
o "ru_majflt" (only if $who is RUSAGE_SELF)
o "ru_maxrss" (only if $who is RUSAGE_SELF)
If getrusage(3) is called with $who set to 1 ( RUSAGE_CHILDREN), then resource usage for threads are collected (meaning that inter-
nally the function is called with RUSAGE_THREAD).
Note
on BeOS 2000, only the following members are returned:
o "ru_stime.tv_sec"
o "ru_stime.tv_usec"
o "ru_utime.tv_sec"
o "ru_utime.tv_usec"
SEE ALSO
Your system's man page on getrusage(2).
PHP Documentation Group GETRUSAGE(3)