09-15-2010
Bash or awk script to solve this problem
Hi everybody!
I have written some awk scripts that return me some results I need to process. At the moment I use openOffice to process them, but I am trying to find a more efficient solution using possibly a bash or awk script.
I have two files, file1 is in the format:
time position
HTML Code:
900.07552 out
900.21297 out
901.53535 out
902.24243 out
903.76858 in
903.80986 in
904.68645 in
905.75785 in
906.13636 in
907.35424 out
908.45325 out
909.23456 in
910.24322 out
911.54478 out
...
Then the second file (file2) is in the format:
time measurement
HTML Code:
896.72412 23
899.84956 12
900.93412 23
903.14356 12
906.00001 18
909.28645 20
910.83635 11
...
I'd like to obtain the lines in file2 correspondent to the time instants in which the position is "in", for example:
HTML Code:
906.00001 18
909.28645 20
Since these files are very long and have variable sizes, I find quite uncomfortable to use openoffice, so I am trying to write a script but I am very new to scripts and I have some problems in comparing lines.. any idea?
Thank you very much!!!!
8 More Discussions You Might Find Interesting
1. Programming
I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent... (4 Replies)
Discussion started by: acqy
4 Replies
2. UNIX for Advanced & Expert Users
well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server...
well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies
3. Programming
Try to solve this.....It's a nice program.....
#include<stdio.h>
void change()
{
/*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ }
void main()
{
int i=5;
change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies
4. UNIX for Advanced & Expert Users
I have a file process.txt
I wanted to just grab data in "process" column.
Name process process_id status
Adminserver adminserver 22669 Running
Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies
5. UNIX for Advanced & Expert Users
Hello everybody!
I have no experience with shell Programmer, but I need to compare 02 files. Txt and generate an output or a new file, after the comparisons. see:
If the column 1 of file1 is equal to column 1 of file2, and column 3 of file2 contains the column 4 of file1, output: column1... (4 Replies)
Discussion started by: He2
4 Replies
6. Shell Programming and Scripting
Take a look on this code:
#!/bin/sh
currentpath=`pwd`
if ; then
#Normal user
if ; then
"$currentpath"/.cleaner
else
./runit
fi
else
#Root user
if ; then
rm -r /some
fi
mkdir /some
cd /home/
echo "`ls --group-directories-first -1`" > /some/allusers
cat /some/allusers | sed 's/... (17 Replies)
Discussion started by: hakermania
17 Replies
7. Shell Programming and Scripting
please can you help me with this script ( very very important )
what I'm trying is to write program that accepts list of user as its argument
1- If a user or more are given as arguments, the script should reset files permissions as follows:
a. Directory ~/share to 750 (if it exists).
b. All... (10 Replies)
Discussion started by: testman84
10 Replies
8. Shell Programming and Scripting
Hi,
I have 100 files containing different values in single column,
I want to split those files in two separate files (file2 and file3) based on average value of first column of each file,
for those files I am working on the following script
#bin/bash
for memb in $(seq 1 100)
do
awk... (4 Replies)
Discussion started by: dsp80
4 Replies
LEARN ABOUT CENTOS
slarrj.f
slarrj.f(3) LAPACK slarrj.f(3)
NAME
slarrj.f -
SYNOPSIS
Functions/Subroutines
subroutine slarrj (N, D, E2, IFIRST, ILAST, RTOL, OFFSET, W, WERR, WORK, IWORK, PIVMIN, SPDIAM, INFO)
SLARRJ performs refinement of the initial estimates of the eigenvalues of the matrix T.
Function/Subroutine Documentation
subroutine slarrj (integerN, real, dimension( * )D, real, dimension( * )E2, integerIFIRST, integerILAST, realRTOL, integerOFFSET, real,
dimension( * )W, real, dimension( * )WERR, real, dimension( * )WORK, integer, dimension( * )IWORK, realPIVMIN, realSPDIAM, integerINFO)
SLARRJ performs refinement of the initial estimates of the eigenvalues of the matrix T.
Purpose:
Given the initial eigenvalue approximations of T, SLARRJ
does bisection to refine the eigenvalues of T,
W( IFIRST-OFFSET ) through W( ILAST-OFFSET ), to more accuracy. Initial
guesses for these eigenvalues are input in W, the corresponding estimate
of the error in these guesses in WERR. During bisection, intervals
[left, right] are maintained by storing their mid-points and
semi-widths in the arrays W and WERR respectively.
Parameters:
N
N is INTEGER
The order of the matrix.
D
D is REAL array, dimension (N)
The N diagonal elements of T.
E2
E2 is REAL array, dimension (N-1)
The Squares of the (N-1) subdiagonal elements of T.
IFIRST
IFIRST is INTEGER
The index of the first eigenvalue to be computed.
ILAST
ILAST is INTEGER
The index of the last eigenvalue to be computed.
RTOL
RTOL is REAL
Tolerance for the convergence of the bisection intervals.
An interval [LEFT,RIGHT] has converged if
RIGHT-LEFT.LT.RTOL*MAX(|LEFT|,|RIGHT|).
OFFSET
OFFSET is INTEGER
Offset for the arrays W and WERR, i.e., the IFIRST-OFFSET
through ILAST-OFFSET elements of these arrays are to be used.
W
W is REAL array, dimension (N)
On input, W( IFIRST-OFFSET ) through W( ILAST-OFFSET ) are
estimates of the eigenvalues of L D L^T indexed IFIRST through
ILAST.
On output, these estimates are refined.
WERR
WERR is REAL array, dimension (N)
On input, WERR( IFIRST-OFFSET ) through WERR( ILAST-OFFSET ) are
the errors in the estimates of the corresponding elements in W.
On output, these errors are refined.
WORK
WORK is REAL array, dimension (2*N)
Workspace.
IWORK
IWORK is INTEGER array, dimension (2*N)
Workspace.
PIVMIN
PIVMIN is REAL
The minimum pivot in the Sturm sequence for T.
SPDIAM
SPDIAM is REAL
The spectral diameter of T.
INFO
INFO is INTEGER
Error flag.
Author:
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
September 2012
Contributors:
Beresford Parlett, University of California, Berkeley, USA
Jim Demmel, University of California, Berkeley, USA
Inderjit Dhillon, University of Texas, Austin, USA
Osni Marques, LBNL/NERSC, USA
Christof Voemel, University of California, Berkeley, USA
Definition at line 167 of file slarrj.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Version 3.4.2 Tue Sep 25 2012 slarrj.f(3)