Search Results

Search: Posts Made By: BigTOE
3,018
Posted By BigTOE
Solved
OK, scratch NR==FNR.

I tweaked jim's:-

awk ' {arr[$1]++; next} END{for (i in arr) {print arr[i], i }} ' mainfile.txt > t.tmp
awk ' FILENAME=="t.tmp" {arr[$2]=$1; next}
...
3,018
Posted By BigTOE
Haha yeah it works, I already put in the '.txt'...
Haha yeah it works, I already put in the '.txt' and the correct paths.

just dont know how it works...

---------- Post updated at 11:26 AM ---------- Previous update was at 09:34 AM ----------...
3,018
Posted By BigTOE
Hi Yinyuemi, I'm afraid not. I understand...
Hi Yinyuemi,

I'm afraid not. I understand the mathematics of how it decides if $1 is in more than once and if so what to do with it, and if not what to do with it.

it's just, at no point do i...
3,018
Posted By BigTOE
awk 'NR==FNR && ++a[$1] >1{b[$1]=1}...
awk 'NR==FNR && ++a[$1] >1{b[$1]=1} NR!=FNR{if(b[$1]) {print >>"file1.txt"} else {print >> "file2.txt"}}' file1.txt file2.txt

That works absolutely perfectly! Thanks guys!

The only thing is I...
3,018
Posted By BigTOE
Hi Jim, Thanks for the reply. It's almost...
Hi Jim,

Thanks for the reply. It's almost there but not quite.

After running, my Files are as follows:

$ cat /mainfile.txt
613212 36 57
613212 36 10
613212 36 10
677774 36 57
619900...
3,018
Posted By BigTOE
Beginner: Count & Sort Using Array's
Hi,

I'm new to linux & bash so please forgive my ignorance, just wondering if anyone can help.

I have a file (mainfile.txt) with comma deliminated values, like so:

$1 $2 $3
613212,...
Showing results 1 to 6 of 6

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