Search Results

Search: Posts Made By: ali.seifaddini
1,393
Posted By Don Cragun
It isn't going to do anything until you change...
It isn't going to do anything until you change the line:
echo mv "$file" "$new"to:
mv "$file" "$new"
1,474
Posted By Don Cragun
That change only affects the 1st line of the...
That change only affects the 1st line of the output. With your sample input, it changes the header from:
SG1 SG2 SG3to:
, SG1 SG2 SG3
If your input file is comma delimited rather than...
1,474
Posted By RudiC
I'd say my code does work VERY well. Using...
I'd say my code does work VERY well.

Using your sample code on your sample files, I getawk 'BEGIN{OFS = "\t"}
NR == FNR {a[$2 " " $3] = $1; next}
{a[$2 " " $3] = (a[$2 " " $3] OFS $1)}
...
1,474
Posted By Don Cragun
If you are using a Solaris/SunOS System, change...
If you are using a Solaris/SunOS System, change awk in the script to /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk.

No matter what system you're using, change the last line of the script from:
...
1,474
Posted By RudiC
Try (untested):awk 'BEGIN {OFS = "\t";...
Try (untested):awk 'BEGIN {OFS = "\t"; HD=OFS OFS}
FNR == 1 {HD=HD OFS FILENAME}
FNR == NR {a[$2 " " $3] = $1; next}
{a[$2 " " $3] = (a[$2 " " $3]...
3,356
Posted By SriniShoo
awk 'BEGIN{OFS = "\t"} NR == FNR {a[$2 " "...
awk 'BEGIN{OFS = "\t"}
NR == FNR {a[$2 " " $3] = $6; next}
{a[$2 " " $3] = (a[$2 " " $3] OFS $6)}
END {for(x in a) print (x OFS a[x])}' file1 file2 file3...
4,682
Posted By Akshay Hegde
make sure that files exists using this $...
make sure that files exists using this

$ for f in $FILES; do echo $f; done

and where did you define variable a and b ?
4,682
Posted By Scrutinizer
In addition, note that: ...
In addition, note that:
FILES=/usr/desktop/input/*
For f in $FILES;
is not the same as:
for f in /usr/desktop/input/*
Obviously For should be for (lowercase) like alister notes, but also, the...
1,363
Posted By Yoda
To use shell variables inside awk program, use...
To use shell variables inside awk program, use awk variable assignment feature:
awk -v A="$a" -v B="$b" '{$6=($1-64)/2 ;$7=((10^($6/10))/A)^(1/B) ; print}' OFS="\t"
Showing results 1 to 9 of 9

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