Finding minimum value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding minimum value
# 8  
Old 08-10-2011
No need for 'paste'; that tool is used to merge lines. I assume the file liist has the filenames to be processed, one per line, right?
The redirection operator you have there, '>' will truncate the output file on every iteration of strings. Use '>>' instead to append; or do the redirection at the end:

Code:
while read line;  do
  while read aa ; do
    awk '$2=="'$aa'" && !($1==$3)' $line
  done < strings > ${line}new
done < liist

You can get rid of the outer shell loop and process all files with awk, and print into the file from awk. Much more efficient. Like this:
Code:
while read aa ; do
  awk '$2=="'$aa'" && !($1==$3){print >> FILENAME"new"}' `cat liist`
done < strings


Last edited by mirni; 08-10-2011 at 06:36 AM.. Reason: rid outer loop
This User Gave Thanks to mirni For This Post:
# 9  
Old 08-11-2011
Thanks a lot mirni......I got the results Smilie

it works well....
# 10  
Old 08-19-2011
Hi,

I am facing one more problem in this......
In the above case, lets say the "strings" list contains 20 strings which are scanned in the original file. If in original file, any three random strings are missing, the immediate next will be printed (i.e, out of 20, only 17 are printed continuously) but I dont want to skip the whole row...instead of that i wanna print "Absent" in each column of that missing row....

Can any one help me for this....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding minimum maximum and average

I am trying to find the minimum maximum and average from one file which has values Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from... (5 Replies)
Discussion started by: aroragaurav.84
5 Replies

2. Shell Programming and Scripting

Find minimum value different from zero

Hello, I have this file file1.csv Element1;23-10-2012;1,450;1,564;1,428 Element2;23-10-2012;1,448;1,565;1,427 Element3;23-10-2012;1,453;1,570;1,424 Element4;23-10-2012;1,428;1,542;1,405 Element5;23-10-2012;1,461;;1,453 Element6;23-10-2012;1,438;1,555;1,417... (6 Replies)
Discussion started by: saba01
6 Replies

3. Shell Programming and Scripting

Finding Minimum in a Series

I have two LARGE files of data more than 20,000 line each, file-1 and file-2, and I wish to do the following if possible: file-1 1 2 5 7 9 2 4 6 3 8 9 4 6 8 9 3 2 1 3 1 2 . . . file-2 1 2 3 2 5 7 5 7 3 7 9 4 . (5 Replies)
Discussion started by: ali2011
5 Replies

4. Shell Programming and Scripting

Finding minimum value out of specific rows

Hi all, I am having multiple files with the pattern given below: I need to find the minimum value of 5th column if column 1 is x and 2nd column is awh or vbn or ... (20 different strings). the output must be like: Kindly help me to figure out this prob.... Thanks in... (4 Replies)
Discussion started by: CAch
4 Replies

5. Shell Programming and Scripting

Find the minimum value

Hi there I have generated a column containing 100.000 values. Sample: 94.971 101.468 73.120 100.601 102.329 I need to find the minimum value in this file and I must know which row it is in (no sorting). I hope you can help! Thanks! (16 Replies)
Discussion started by: cno
16 Replies

6. Shell Programming and Scripting

Finding Minimum value per Row range of data

Here is an example of a file I am working with: C 4704 CB 1318 ASP 115 BGRF 1 weak 0.0% 4.33 C 4720 OD 1322 ASP 115 BGRF 1 weak 0.0% 3.71 O 4723 OD 1322 ASP 115 BGRF 1 weak 0.0% 3.48 O 4723 CG 1321 ASP 115 BGRF 1 weak 0.0% 4.34... (3 Replies)
Discussion started by: userix
3 Replies

7. HP-UX

minimum password length

Dear frnds, how i can make the password 5chs minimum length in hp-ux 11i ? pls help regards (3 Replies)
Discussion started by: jestinabel
3 Replies

8. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

9. UNIX for Dummies Questions & Answers

AIX minimum requirements

What are the minimum hardware requirements to install AIX. Completely new to this. (2 Replies)
Discussion started by: boricua
2 Replies

10. UNIX for Dummies Questions & Answers

Minimum RAM

Can anyone tell me the minimum ram requirements for suse 6.1 & mdk9 please? Will they accept edo ram? (3 Replies)
Discussion started by: onestepto
3 Replies
Login or Register to Ask a Question