10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I want to split this with every 5 or 50 depend on how much data the file will have. And remove the comma on the end
Source file will have
001,0002,0003,004,005,0006,0007,007A,007B,007C,007E,007F,008A,008C
Need Output from every 5 tab and remove the comma from end of each row
... (4 Replies)
Discussion started by: ranjancom2000
4 Replies
2. Shell Programming and Scripting
Unable to get the desired output. Need only the rows which has repeated values in column 5.
Input File <tab separated file>
chr1 3773797 3773797 CEP10 1
chr1 3773797 3773797 CEP104 2
chr1 3689350 3689350 SMIM1 2
chr1 3773797 3773797 CEP4 3
chr1 3773797 3773797 EP104 ... (7 Replies)
Discussion started by: himanshu
7 Replies
3. Shell Programming and Scripting
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)
Discussion started by: ncwxpanther
3 Replies
4. Shell Programming and Scripting
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)
Discussion started by: ncwxpanther
6 Replies
5. Shell Programming and Scripting
Hi everyone,
I have a data file in which the data is stored in event blocks. What I would like to get is that the same file with every data row starting with the number of event block. So here is two event blocks from my file:
<event>
-2 -1 0 0 0 501 0.00000000000E+00
... (2 Replies)
Discussion started by: hayreter
2 Replies
6. UNIX for Dummies Questions & Answers
Hi !
input:
A|B|C|D
A|F|C|E
A|B|I|C
A|T|I|B
As the title of the thread says, I would need to get:
1|3|2|4
I tried different variants of this command, but I don't manage to obtain what I need:
gawk 'BEGIN{FS=OFS="|"}{for(i=1; i<=NF; i++) a++} END {for (b in a) print b}' input
... (2 Replies)
Discussion started by: beca123456
2 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have the following input which i want to process using AWK.
Rows,NC,amount
1,1202,0.192387
2,1201,0.111111
3,1201,0.123456
i want the following output
count of rows = 3 ,sum of amount = 0.426954
Many thanks (2 Replies)
Discussion started by: pistachio
2 Replies
8. UNIX for Dummies Questions & Answers
Is there anyway to use awk to add a first column to my data that automatically goes from 1 to n , where n is the numbers of my rows?:confused: (4 Replies)
Discussion started by: cosmologist
4 Replies
9. Shell Programming and Scripting
All,
$ cat myf.txt
A|xyz|1000|mm
B|9000|xyz|ss
C|BDE|2000|kk
D|xyz|1000|nn
I am searching "xyz"
$ awk -F "|" '
{for(k=0;k<=NF;k++)
if ( $k == "xyz" )
print "line="NR"(column="k")"
}' myf.txt
Output:
line=1(column=2)
line=2(column=3)
line=4(column=2) (2 Replies)
Discussion started by: jkl_jkl
2 Replies
10. Shell Programming and Scripting
The awk command awk -F: '{print $1}' test1 gives the first columns of all the lines in file ,is there some command to get a particular column from particular line .
Any help is appreciated.
thanks arif (4 Replies)
Discussion started by: mab_arif16
4 Replies