Search Results

Search: Posts Made By: Unilearn
2,195
Posted By jim mcnamara
Do us all a favor: give us all your requirements...
Do us all a favor: give us all your requirements up front, instead of letting us know about each new one them 1 by 1. We are not a code development service....

extract up to N and file name in...
3,841
Posted By agama
If your files are relatively small a simple awk...
If your files are relatively small a simple awk should work:


awk '
{ c[$1]++; f[$1] = f[$1] FILENAME " "; }
END {
for( x in f )
if( c[x] > 1 )
...
22,768
Posted By Corona688
Best to ask for what you need on the first go :D ...
Best to ask for what you need on the first go :D
awk 'NR==1 { next }
{ T=0
for(N=2; N<=NF; N++) T+=$N;
T/=(NF-1)
print $1, T }' file > outfile

That...
22,768
Posted By jim mcnamara
awk 'NR==1{next} {printf("%s\t", $1 ...
awk 'NR==1{next}
{printf("%s\t", $1
printf("%.2f\n", ($2 + $3 + $4)/3 }' file1 > newfile
2,076
Posted By m.d.ludwig
tr '\t' '\n' < infile > outfileSee the tr manual...
tr '\t' '\n' < infile > outfileSee the tr manual page for more details.
3,531
Posted By bartus11
Try this: perl -ane '$a[$.]=$_;END{print sort...
Try this: perl -ane '$a[$.]=$_;END{print sort {(split /\s+/,$a)[7]<=>(split /\s+/,$b)[7]}@a}' file
4,263
Posted By bartus11
sort -nk2 file
sort -nk2 file
1,463
Posted By Peasant
Convert the files to unix file format using...
Convert the files to unix file format using dos2unix utility and try again with paste please.

Hope that helps.
Regards
Peasant.
1,463
Posted By frank_rizzo
paste file1.txt file2.txt see man page for...
paste file1.txt file2.txt

see man page for further options.
1,842
Posted By neutronscott
It's the FNR>1 which probably skips the titles....
It's the FNR>1 which probably skips the titles. FNR means File Record Number (usually line number), thus line1 is excluded...
3,641
Posted By getmmg
Unilearn, Anyways i dont have work now, so...
Unilearn,

Anyways i dont have work now, so here it goes :)

-lane reads the file line by line, -a splits the line and store array @F.
Read perldoc to get more on this.
...
3,641
Posted By getmmg
Indeed. Nice way to do it. ---------- Post...
Indeed. Nice way to do it.

---------- Post updated at 01:13 PM ---------- Previous update was at 01:06 PM ----------




This should fix that.


perl -lane...
3,641
Posted By bartus11
You can try this too (might be faster?:))perl -pe...
You can try this too (might be faster?:))perl -pe '/((\w+\t){6})(.*\n)/;$x=$1;$y=$3;$y=~s/(\w+)\t(\w+)(\t|$)/\1\2\3/g;$_="$x$y"' file
3,641
Posted By getmmg
Try this. Here the output also will tab...
Try this. Here the output also will tab separated. Change \t to any other delimiter if you dont want tab separated output.

perl -lane...
3,361
Posted By getmmg
Columns will be in the order of how the file are...
Columns will be in the order of how the file are given.


perl -lane '$hash{$F[1]}.=" $F[8]";END{print "$_ $hash{$_}" for keys %hash}' file1 file2


And the output is

ab2 0.0007...
3,981
Posted By radoulov
Try this: perl -i.bck -ple's/(\d) +/\1\t/g'...
Try this:

perl -i.bck -ple's/(\d) +/\1\t/g' infile
Showing results 1 to 16 of 16

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