09-15-2009
Just realised that I used vgersh99's solution. Here are the updated result with Franklin52's one.
with nawk:
real 0m0.279s
user 0m0.272s
sys 0m0.008s
with mawk:
real 0m0.141s
user 0m0.084s
sys 0m0.016s
with the cat | cut | sort | uniq
real 0m0.943s
user 0m0.888s
sys 0m0.052s
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I can't find how to achive such thing, please help.
I have try with uniq and comm but those command can't compare columns just whole lines,
I think awk will be the best but awk is magic for me as of now.
file a
a1~a2~a3~a4~a6~a7~a8
file b
b1~b2~b3~b4~b6~b7~b8
output 1:
compare... (2 Replies)
Discussion started by: pp56825
2 Replies
2. Shell Programming and Scripting
I am trying to compare two file and make changes where ever its different.
for example:
Contents of file1
IP=192.165.89.11
NM=255.255.0.0
GW=192.165.89.1
Contents of file2
IP=192.165.89.11
NM=255.255.255.255
GW=192.165.89.1
NOTE HERE THAT NM IS DIFFERENT
So i want the changes... (6 Replies)
Discussion started by: pradeepreddy
6 Replies
3. Ubuntu
Hello,
I have a 1.6 GB file that I would like to modify by matching some ids in col1 with the ids in col 1 of file2.txt and save the results into a 3rd file.
For example:
File 1 has 1411 rows, I ignore how many columns it has (thousands)
File 2 has 311 rows, 1 column
Would like to... (7 Replies)
Discussion started by: sogi
7 Replies
4. Shell Programming and Scripting
Hi,
My first file has
592155 9 rs16916098 1
592156 19 rs7249604 1
592157 4 rs885156 1
592158 5 rs350067 12nd file has
9 rs16916098 0 113228129 2 4
19 rs7249604 0 58709070 4 2
2 rs17042833 0 113558750 4 2... (2 Replies)
Discussion started by: genehunter
2 Replies
5. Shell Programming and Scripting
Hi, Experts,
I have a requirement as following:
my source file:
a
a
a
b
b
c
c
c
c
I need add one more colume as following:
1 a
2 a
3 a
1 b
2 b
1 c
2 c (4 Replies)
Discussion started by: ken002
4 Replies
6. UNIX for Advanced & Expert Users
Hello everyone,
I am writing a script to process data from the ATP world tour.
I have a file which contains:
t=540 y=2011 r=1 p=N409
t=540 y=2011 r=2 p=N409
t=540 y=2011 r=3 p=N409
t=540 y=2011 r=4 p=N409
t=520 y=2011 r=1 p=N409
t=520 y=2011 r=2 p=N409
t=520 y=2011 r=3 p=N409
The... (4 Replies)
Discussion started by: imahmoud
4 Replies
7. Shell Programming and Scripting
Hello,
I have some tab delimited data and I need to move the last col. I could hard code it,
awk '{ print $1,$NF,$2,$3,$4,etc }' infile > outfile
but it would be nice to know the syntax to print a range cols.
I know in cut you can do,
cut -f 1,4-8,11-
to print fields 1,... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
8. Shell Programming and Scripting
Hi Friends,
This is the only solution to my task. So, any help is highly appreciated.
I have a file
cat input1.bed
chr1 100 200 abc
chr1 120 300 def
chr1 145 226 ghi
chr2 567 600 unix
Now, I have another file by name
input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies
9. Shell Programming and Scripting
Hi,
Please help with this.
I have several excel files (with and .xlsx format) with 10-15 columns each.
They all have the same type of data but the columns are not ordered in the same way.
Here is a 3 column example. What I want to do add the alphabet
from column 2 to column 3, provided... (9 Replies)
Discussion started by: newbie83
9 Replies
10. UNIX for Beginners Questions & Answers
hi
I have 2 file with more than 10 columns for both
1st file
apple,0,0,0......
orange,1,2,3.....
mango,2,4,5.....
2nd file
apple,2,3,4,5,6,7...
orange,2,3,4,5,6,8...
watermerlon,2,3,4,5,6,abc...
mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies
LEARN ABOUT REDHAT
setregid
SETREUID(2) Linux Programmer's Manual SETREUID(2)
NAME
setreuid, setregid - set real and/or effective user or group ID
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int setreuid(uid_t ruid, uid_t euid);
int setregid(gid_t rgid, gid_t egid);
DESCRIPTION
setreuid sets real and effective user IDs of the current process. Unprivileged users may only set the real user ID to the real user ID or
the effective user ID, and may only set the effective user ID to the real user ID, the effective user ID or the saved user ID.
Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.
If the real user ID is set or the effective user ID is set to a value not equal to the previous real user ID, the saved user ID will be set
to the new effective user ID.
Completely analogously, setregid sets real and effective group ID's of the current process, and all of the above holds with "group" instead
of "user".
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EPERM The current process is not the super-user and changes other than (i) swapping the effective user (group) ID with the real user
(group) ID, or (ii) setting one to the value of the other or (iii) setting the effective user (group) ID to the value of the saved
user (group) ID was specified.
NOTES
Setting the effective user (group) ID to the saved user ID is possible since Linux 1.1.37 (1.1.38).
CONFORMING TO
BSD 4.3 (the setreuid and setregid function calls first appeared in 4.2BSD).
SEE ALSO
getuid(2), getgid(2), setuid(2), setgid(2), seteuid(2), setresuid(2)
Linux 1.1.38 1994-08-02 SETREUID(2)