Search Results

Search: Posts Made By: coppuca
4,412
Posted By rdrtx1
It prints the line occurrence of column 1 ($1)....
It prints the line occurrence of column 1 ($1). a[$1]++ fails for the first occurrence increment since the array value for that key does not exist. The ! means not true so the expression is evaluated...
4,412
Posted By rdrtx1
try: sort -k9 -n -r file | awk '!a[$1]++' ...
try:

sort -k9 -n -r file | awk '!a[$1]++'

In output shown above, what happened to the max line for chr1_17232_18061?
3,065
Posted By rbatte1
Can I add a word of caution that the lines in...
Can I add a word of caution that the lines in your exclude file will match anywhere on the line in your input file. If you need to ensure that it is (for example) only lines starting with abc then...
3,065
Posted By bakunin
In this case go with RudiCs excellent suggestion:...
In this case go with RudiCs excellent suggestion: "-v" inverts the match, excluding the lines matching the pattern and "-f" reads the patterns from a file instead of arguments from the command line....
3,065
Posted By Don Cragun
Then RudiC's suggestion should do what you...
Then RudiC's suggestion should do what you want...
If the patterns in mylist are fixed strings, then:
grep -Fvf mylist file
will run a little bit faster. And, if the patterns are extended regular...
3,065
Posted By RudiC
Did you consider using a pattern file: grep -vf...
Did you consider using a pattern file:
grep -vf mylist file
This may not be the most efficient method, though.
2,181
Posted By Corona688
How many different files are we talking about? ...
How many different files are we talking about? This may work, but if there's more than 20 outputs or so, awk may choke from opening too many files:

awk '!($1 in A) { A[$1]="File" ++X } ; { print...
3,125
Posted By Yoda
Using awk; reading input file twice: awk ' ...
Using awk; reading input file twice:
awk '
NR == 1 {
print
}
NR == FNR && NR > 1 {
i = $2 FS $3 FS $4 FS $5
A[i] += $1
...
1,283
Posted By pravin27
Hi, Please use code tag for your input file,...
Hi,

Please use code tag for your input file, which help to make thread more readable.

Use below code for the desire o/p.

awk 'NR==FNR{a[$1]=$2;next}
a[$1]{print $0,a[$1];next}{print $0,"-...
Showing results 1 to 9 of 9

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