I need to be able to print the contents of a specified column, while ignoring the alpha characters. In this case the "W" and "T". However, for those instances where "T" occurs, there is a numeric character which needs to be preserved. So the "0" needs to stay.
When we count the columns from left to right, we are not counting the columns with "W". In my example, the line that contains "123" would have 16 columns. I need to print just column 3. So my desired output would be 25.
I could make this a 2 step process, eliminating the alpha characters first, then count the columns, but was hoping for a simple 1 liner.
Thanks
---------- Post updated at 02:17 PM ---------- Previous update was at 07:37 AM ----------
I was able to utilize this script to extract out a single column of data. But what if i wanted multiple columns? Say columns 3, 4 and 5
Hi,
I would like to take the first column of a bunch of lines and take only the 6th through 15th characters. The first column are not regular.
gbAY277147.1Ptv3.T1469 CTTGAACAT
gbAY277149.1Ptro3.T1469 CTTGAACAT
gbAY287891.1Hs3.T1469 CTTGAACATTTGC
into
7147.1Ptv3 CTTGAACAT... (4 Replies)
Hi guys,
I usualy am able to google awk stuff but I can't find it so far and there are so many awking gurus here that I will give it a shot.
I want to print $1;$3;"$5 up to the $NF". In other words, I can have 1000 colums, but need to have $5 up to the end.
I started with the idea of... (2 Replies)
Hi,
I have a wide and long dataset which looks as follows:
0 3 4 2 3 0 2 2 ...
3 2 4 0 2 2 2 3 ...
0 3 4 2 0 4 4 4 ...
3 0 4 2 2 4 2 4 ...
....
I would like to obtain the minimum of each column (ignoring zero values) so the output would look like:
3 2 4 2 2 2 2 2
I have the... (3 Replies)
Hi i have data like
abchd 124 ldskc aattggcc
each separated by tab space i want to count number of characters in 4th column and print it in new column with tabspace for every line can anyone help me how to do it.
Thanks. (3 Replies)
Hello all,
I have a data like this:
X:04252 X:05524 X:04176
X:05509 X:05524 X:04674-
X:1662912 X:10181
X:16491 X:05506
X:05216- X:05488
X:46872 X:08471
X:04834 X:30170
The except result is like this:
X:04252 X:05524 X:04176
X:05509 X:05524 X:04674
X:16629 X:10181... (3 Replies)
Hi all,
I want to count total no. of characters in a column. and if no. of charaters are more than 3 then it must replace it by splitted string. ie, it must place a space after 3 characters.
Ex:
21 435g asd3dd jklfjwe wer
column number 3 has 4 alphanumeric character, so it must be splitted... (3 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)
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)
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)