I have the following script that will print column 4 ("25") when column 1 contains "123". However, I need to ignore the alpha characters that are contained in the input file. If I were to ignore the characters my output would be column 3.
What is the best way to print my column of interest... (3 Replies)
I have the following awk script that I am using to find the max value in the file and print results.
awk 'BEGIN {MAX=-1E100} {for (x=2; x<=NF; x++) if ($x>MAX) {MAX = $x; C1 = $1}} END {print substr(C1,1,11), substr(C1,13,4), substr(C1,18,2), MAX}' ABC*
Input (ABC*)
... (6 Replies)
Hi All,
I have a file test.txt.
Content of test.txt :
1 vinay se
2 kumar sse
4 kishore tl
I am extracting the content of file with below command.
awk '$2 ~ "vinay" {print $0}' test.txt
Now instead of hardcoding $2 is there any way pass $2 as variable and compare with a... (7 Replies)
Input file :
5 20
500 2
20 41
41 0
23 1
Desired output :
5
2
20
0
1
By comparing column 1 and 2 in each line, I hope can print out the column with smallest number.
I did try the following code, but it don't look good :( (2 Replies)
Hi,
My input files is like this
axis1 0 1 10
axis2 0 1 5
axis1 1 2 -4
axis2 2 3 -3
axis1 3 4 5
axis2 3 4 -1
axis1 4 5 -6
axis2 4 5 1
Now, these are my following tasks
1. Print a first column for every two rows that has the same value followed by a string.
2. Match on the... (3 Replies)
Hi Geeks,
Consider this line:
driver=c:\folder1\folder2
The above line is contained in a variable say 'var' . I want to copy everything after 'driver=' in to another variable say var2.
Please tell me how can this be done. (8 Replies)
Hi Everybody.
I need an urgent help, it would be great if somebody will help me out in this regard. See below sample file
1525 805 26 2036 219644. 2598293.
1525 805 126 2327
1525 805 226 ... (6 Replies)
i want to print the column file using awk or cut in dynamic manner
like
trmp=2;temp1=1;temp3=2
awk 'BEGIN{OFS=IFS="\t"} {print $temp,$temp1,$temp3}' client_data.txt
or cut -f $temp1,$temp2,$temp3 -d"\t" file_name .
but it is showing error , In awk can i use variable as in printing... (36 Replies)