06-02-2010
1. large datafiles to be queried called "file.dat*" (column one is serial number, others are data)
file.dat1
rs10001 900 900 100 100
rs10002 800 300 200 100
file.dat2
rs10003 222 111 333 444
rs10004 999 121 232 434
2. small masterlist/cheatsheet called "master.list" with three columns: serial#,row#,filename
rs10001 1 file.dat1
rs10002 2 file.dat1
rs10003 1 file.dat2
rs10004 2 file.dat2
3. If I want to recover rs10001 and rs10004 data, I grep from my masterlist to create a subset of insterest called subset.txt
subset.txt
rs10001 1 file.dat1
rs10004 2 file.dat2
Now, I need to recover the original data for each serial number with the expected output:
rs10001 900 900 100 100
rs10004 999 121 232 434
Thanks,
jeeplou
Last edited by jeeplou; 06-02-2010 at 01:04 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
$ echo |awk ' BEGIN {"date" | getline current_time;close("date");print "Report printed on " current_time}'
Report printed on Thu May 11 14:57:29 METDST 2006
This example works fine but how can i print all the output when is longer... (3 Replies)
Discussion started by: Klashxx
3 Replies
2. Shell Programming and Scripting
hello collegues,
I am attempting to use awk to search file1 (serverlist.csv) from each row with file2 (supported.txt). If the is no entry exists in serverlist then output to a file called notsupp.out if there is an entry output to supp.out
I can do this with basic shell scripting however... (0 Replies)
Discussion started by: chlawren
0 Replies
3. Shell Programming and Scripting
Hello,
Need some help here. I have this script (test.sh):
#!/bin/sh
var=$1
(( var = 2 * var ))
echo $var
Now I want to call this script from awk with one argument and then capture the result in a variable, something like:
echo 40 | awk ' { x = $1; "test.sh " x | getline y; print y }... (1 Reply)
Discussion started by: fbg
1 Replies
4. Shell Programming and Scripting
How do you make the getline function return to the original line?
The example below should make it clear where I am currently going wrong.
Thanks
AWK SCRIPT:
-------------
awk -F '-' '{
tmpLine = "EMPTY"
print "CURRENT LINE :"$0
getline tmpLine
print "NEXT LINE :"tmpLine
}'... (1 Reply)
Discussion started by: garethsays
1 Replies
5. Shell Programming and Scripting
I am using awk and want to use getline from a file like below
getline x < file
However file consists of two columns and I only want to store $2
Any way I can do this?
---------- Post updated at 06:54 AM ---------- Previous update was at 06:45 AM ----------
Done something like this.... (1 Reply)
Discussion started by: kristinu
1 Replies
6. Shell Programming and Scripting
Hi there, I have an ifconfig output and i want to write a script that determines whether there is a line "groupname ipmp" on a particular interface
here is my example ifconfig -a output
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1... (2 Replies)
Discussion started by: rethink
2 Replies
7. Shell Programming and Scripting
I want to import a textfile with getline into var t which has several lines. How do import all lines, since it only imports the last line:
while < ((getline t "textfile") > 0) (7 Replies)
Discussion started by: sdf
7 Replies
8. Shell Programming and Scripting
Hello,
I want to print out the DNA sequence entries (tens of thousand!) that are longer than certain value (i=200) from a file (FASTA file) as:
>S94D_ctg_8004 Average coverage: 402.95
ATAATGCCTGTGAATATGACATGTGTTCCTGTTTCTACATCAGACTACTATTCTTGCATA... (12 Replies)
Discussion started by: yifangt
12 Replies
9. Shell Programming and Scripting
Hi,
I have an awk script with the following function in it .
function cmd( c )
{
while( ( c | getline foo) > 0 ){
return foo ;
close( c );
}
}
c =... (4 Replies)
Discussion started by: MetaMan
4 Replies
10. Shell Programming and Scripting
Howdy Folks,
It seems like it is always awk that confuses the heck out of me and I even have books and examples.
I have this line:
awk '{if (/clientIP/)(SRV = $NF); if ($2 ~ /BUNDLE-GIM/) getline; if ($2 ~ /r100595/) {print SRV,"BUNDLE-GIM",$2}}' post.txt
to parse this text:
<api... (4 Replies)
Discussion started by: port43
4 Replies
LEARN ABOUT NETBSD
prop_data
PROP_DATA(3) BSD Library Functions Manual PROP_DATA(3)
NAME
prop_data, prop_data_create_data, prop_data_create_data_nocopy, prop_data_copy, prop_data_size, prop_data_data, prop_data_data_nocopy,
prop_data_equals, prop_data_equals_data -- opaque data value property object
LIBRARY
Property Container Object Library (libprop, -lprop)
SYNOPSIS
#include <prop/proplib.h>
prop_data_t
prop_data_create_data(const void *blob, size_t len);
prop_data_t
prop_data_create_data_nocopy(const void *blob, size_t len);
prop_data_t
prop_data_copy(prop_data_t data);
size_t
prop_data_size(prop_data_t data);
void *
prop_data_data(prop_data_t data);
const void *
prop_data_data_nocopy(prop_data_t data);
bool
prop_data_equals(prop_data_t dat1, prop_data_t dat2);
bool
prop_data_equals_data(prop_data_t data, const void *blob, size_t len);
DESCRIPTION
The prop_data family of functions operate on an opaque data value property object type.
prop_data_create_data(const void *blob, size_t len)
Create a data object that contains a copy of blob with size len. Returns NULL on failure.
prop_data_create_data_nocopy(const void *blob, size_t len)
Create a data object that contains a reference to blob with size len. Returns NULL on failure.
prop_data_copy(prop_data_t data)
Copy a data object. If the data object being copied is an external data reference, then the copy also references the same external
data. Returns NULL on failure.
prop_data_size(prop_data_t data)
Returns the size of the data object. If the supplied object isn't a data object, zero is returned.
prop_data_data(prop_data_t data)
Returns a copy of the data object's contents. The caller is responsible for freeing the returned buffer. If the supplied object
isn't a data object or if the data container is empty, NULL is returned.
In user space, the buffer is allocated using malloc(3). In the kernel, the buffer is allocated using malloc(9) using the malloc type
M_TEMP.
prop_data_data_nocopy(prop_data_t data)
Returns an immutable reference to the contents of the data object. If the supplied object isn't a data object, NULL is returned.
prop_data_equals(prop_data_t dat1, prop_data_t dat2)
Returns true if the two data objects are equivalent. If at least one of the supplied objects isn't a data object, false is returned.
prop_data_equals_data(prop_data_t data, const void *blob, size_t len)
Returns true if the data object's value is equivalent to blob with size len. If the supplied object isn't a data object, false is
returned.
SEE ALSO
prop_array(3), prop_bool(3), prop_dictionary(3), prop_number(3), prop_object(3), prop_string(3), proplib(3)
HISTORY
The proplib property container object library first appeared in NetBSD 4.0.
BSD
April 22, 2006 BSD