Search Results

Search: Posts Made By: kingkong
39,775
Posted By kingkong
Gaurav, Problem: I want to find the...
Gaurav,

Problem:
I want to find the maximum value in column 2 and 3 in file.txt (given below) and print the line containing this value. Hence, the following line should be printed (because 68.7...
39,775
Posted By kingkong
Gaurav, Sorry, but it still does not work. ...
Gaurav,

Sorry, but it still does not work.

Output:

+ solution.sh
+ maximum=0
+ cat file.txt
+ read LINE
++ echo 1001 34.5 68.7 67
++ awk '{print $2}'
+ fir=34.5
++ echo 1001 34.5 68.7...
39,775
Posted By kingkong
Gaurav, I renamed it, so the script max is...
Gaurav,

I renamed it, so the script max is gone.

Kingkong
39,775
Posted By kingkong
Gaurav, Sorry, but the same errors occur...
Gaurav,

Sorry, but the same errors occur with new file name

Kingkong
39,775
Posted By kingkong
Hi Gaurav, I pasted the exact code into a...
Hi Gaurav,

I pasted the exact code into a script named max.

Kingkong
39,775
Posted By kingkong
Hey Gaurav, This time the output is as...
Hey Gaurav,

This time the output is as follows:

+ max
+ max=0
+ cat file.txt
+ read LINE
++ echo 1001 34.5 68.7 67
++ awk '{print $2}'
+ fir=34.5
++ echo 1001 34.5 68.7 67
++ awk...
39,775
Posted By kingkong
Hey Gaurav! The output is with set -x...
Hey Gaurav!

The output is with set -x enabled:

+ max
cat: soln.sh: No such file or directory
+ max=0
+ cat file.txt
+ read LINE
++ echo 1001 34.5 68.7 67
++ awk '{print $2}'
+ fir=34.5...
39,775
Posted By kingkong
Hey Gaurav, and thanks again! I use bash...
Hey Gaurav, and thanks again!

I use bash shell. However, by typing #!/bin/sh at the top of the script a thought I would convert to sh shell. I tried this, but the code does still not work for me. ...
39,775
Posted By kingkong
Hello Matrixmadhan! The code works...
Hello Matrixmadhan!

The code works excellent! Thank you very much and best regards!

Kingkong
39,775
Posted By kingkong
Hey Gaurav! First of all, many thanks for...
Hey Gaurav!

First of all, many thanks for your time!

I do not get the code to work as desired. The first error message I get reads "integer expression expected". When I try again with column 2...
39,775
Posted By kingkong
Print the line containing the maximum value in a column
Dear all!

I want to find the maximum value in two specific columns with numbers, and then print the entire line containing this value. The file may look like:

1001 34.5 68.7 67
1002 ...
4,525
Posted By kingkong
That was fast! Thank you a lot!!
That was fast! Thank you a lot!!
4,525
Posted By kingkong
How to extract many lines from a file, typically the 1000 last
Hello!

Is it anyone who might know how to extract the n last lines from a file, typically the 1000 last? Until know I have used sed -n np filename, but it takes each line separately, and is hence...
7,213
Posted By kingkong
Thank you very much! The code works excelent!
Thank you very much! The code works excelent!
7,213
Posted By kingkong
Extracting columns from different files for later merging
Hello!

I wan't to extract columns from two files and later combine them for plotting with gnuplot. If the files file1 and file2 look like:

fiile1:
a, 0.62,x
b, 0.61,x

file2:
a, 0.43,x...
10,256
Posted By kingkong
Thank you!
Thank you very much! This will help me a lot!
3,109
Posted By kingkong
Extract line from file
Dear Members!

How can I extract on line from a file?
10,256
Posted By kingkong
Extract line from file
Hello, guys!

I want to extract one specific line from a file. Can someone help me with this?
Showing results 1 to 18 of 18

 
All times are GMT -4. The time now is 04:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy