I don't think marsd's script is exactly what I want. I actually want 10 random samples from my datafile (each 1/10th of the datafile. I use this script to select a random sample from a datafile:
BEGIN {
select = 100 # random sample
remaining = 1000 # number of records
}
{
if (rand() <...
Hi CyanBlue,
if you want to insert the content of a second file in your file you can use getline:
{
if (NR == line) {
print
while ((getline < "FileB.txt") > 0) {
print
}
}
else print
}
awk -f script.awk -v line=4 FileA.txt
Greetz,
Sancho
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.