Search Results

Search: Posts Made By: NamS
12,281
Posted By aaysa123
print ODD lines
i want to print ODD lines like first ,third then fifth and so on


234,567,ABC,KJL
234,565,ABD,KJL
234,568,ABE,KJL
234,560,ABF,KJL
234,563,ABG,KJL
234,562,ABH,KJL

O/P will be like...
4,106
Posted By RudiC
You'll have to adapt it thoroughly, as the...
You'll have to adapt it thoroughly, as the boundary conditions have changed!awk 'NR==1 {N=4}
NR>=N {printf "%s\n",sum; N+=3; sum=0}
{sum+=$1}...
4,106
Posted By Subbeh
As you're only dealing with one column, and...
As you're only dealing with one column, and working with consecutive numbers it's a lot simpler:
awk '{sum+=$1} NR%3==0{print sum; sum=0}' file
1,599
Posted By RudiC
The logic you describe and the sample you give do...
The logic you describe and the sample you give do not coincide. Anyhow, using 6 as the delta to increase your field 1 counter, tryawk 'NR==1 {printf "%s\t",$1; N=$1+6}
$1>=N ...
2,597
Posted By RudiC
For not too large files, try:grep -v "$(cut -d" "...
For not too large files, try:grep -v "$(cut -d" " -f1,2 file2)" file1
sc2/10 10 . G C 50 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
2,597
Posted By rdcwayx
awk 'NR==FNR{a[$1 FS $2];next} !($1 FS $2 in a)'...
awk 'NR==FNR{a[$1 FS $2];next} !($1 FS $2 in a)' file2 file1

sc2/10 10 . G C 50 F=5;U=4
sc2/24 24 . T G 31 F=5;U=4
sc2/11 30 . A T 60 F=5;U=4
1,746
Posted By Scrutinizer
Try: awk 'NR==FNR{A[$1,$2,$4]=$0;...
Try:
awk 'NR==FNR{A[$1,$2,$4]=$0; A[$1,$2,$5]=$0; next} $4==$5 && ($1,$2,$4) in A {print A[$1,$2,$4] ";" $0}' file1 file2
1,353
Posted By Franklin52
Bumping up posts or double posting is not...
Bumping up posts or double posting is not permitted in these forums.

Please read the rules (https://www.unix.com/misc.php?do=cfrules), which you agreed to when you registered, if you have not...
Showing results 1 to 8 of 8

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