Hello,
I have a problem with cut -d -f$list
the requirements of "cut" command, the list have to be sorted increasing.
but, somehow, i have a list which is have to look like this :
1,2,3,4,5,29,25,11,15,231,227,213,217,433,429,415,
419,635,631,617,621...
Hello,
I have a problem with cut -d -f$list
the requirements of "cut" command, the list have to be sorted increasing.
but, somehow, i have a list which is have to look like this :
1,2,3,4,5,29,25,11,15,231,227,213,217,433,429,415,419,635...
Oh I see,
so, for example, the a string is created like this :
a=$(nawk 'BEGIN { printf("a,b,c"); for (i=1;i<100;i+3) { printf("\n%d,%d,%d",i,i+1,i+2) }
}')
so, if i have that 'a' and and i put that a on :
nawk '{
a=$(nawk 'BEGIN { printf("a,b,c"); for...
Hi,
Can someone advise me to correct this script :
a="1,2,3,4,5,6,7,8"
nawk 'BEGIN { FS="," }
{ asum=split(a,b,FS)
printf ("%d",asum)
}
the result is asum = 0.
it supposed to be returning 8.
Please help
Thanks
Thanks PH,
But something wrong happen when i tried to run your lines,
this is the warning :
nawk: trying to access field 619
input record number 1, file Paysf11.txt
source line number 4
and to make things more clear.
I still want to do like this :
grep "^[13];psf\/210;" $filen |...
Hello,
I have this command on someone's script :
grep "^[13];psf\/210;" $filen | cut -d";" -f$List >> ${pathOut}/psf_210_${dateFile}.txt
The 'List' created with awk :
List=$(nawk 'BEGIN { printf("1,2,3,4,5"); for(i=9; i<=2231; i+=202) {...
Hi Salem,
Thanks for your reply,
Yes, finally, after adding the end-brackets before do the splitting... it works.
But, I have another problem,
Why does the result always repeat ?
If the input file have 7 line,
then, the result will have 7 times which all the same.
Example :
abc1;1;2;3;4;5...
to be simple,
here is a test script that i've made :
nawk 'BEGIN { printf("1,2,3,4,5");
split($0,a,";");
for(i=9; i<=2231; i+=202) {
printf("%d",a[i]);
}}' Paysf.txt
result :
1,2,3,4,500000000
Please help me with this.
Hi Salem,
actually, the array are not from index 1.
the whole script like this.
for(i=9; i<=2231; i+=202) {
split($0, a, ";");
if (a[1] == "P1") {
x1=a[i+2];
y1=a[i+6]
}
else if (a[1] == "P2") {
x2=a[i];
y2=a[i+2]
}...
Still about split.
This looks difference with the another split command which is usually used in awk, right ?
as far as i know, with that split we can split a file according a separator and put them into an array.
but somehow, i tried them and does not work well.
I don't know if the split can...
Hello Ygor,
I already tried them,
but still not working, this error still appear :
stat@advcom:/s/i/Stat/testbed> ./testaw3.sh
awk: record `3;a/210;7;abc1...' too long
record number 1
actually, i had a script, another person made the script, and i just know the functional of the script...
hi Ygor,
I've tried your suggestions.
It is worked.
But, for a file with more columns, awk will output this error message :
awk - argument too long..
so, it won't produce any output.
this is the sample one line :
3;a;7;abc2;20030727050209;0;0;;4;3;1234;3;1000;3;X 2;3;X 3;3;X 4;3;X 5;3;X 6;3;X...
Hi Ygor,
Thanks for your reply...
I hope you still can help me for further questions...
what if, all of them are in one file, and they are separate by a keyword..
for example :
abc1;20;90;77;88;99
abc2;22;93;71;68;89
abc2;31;60;21;87;74
abc1;32;76;55;13;93
abc2;39;96;57;83;27
...
...
How can...
Hello,
I have a simple question, hope that somebody would help.
As i just browse a little about AWK, i don't really understand how to interprete my idea into AWK syntax.
File1
A1;Input1;A3;A4;A5
20;90;77;88;99
33;80;81;67;54
32;76;55;13;93
..
..
..
File2
B1;Input2;B3;B4;B5
22;93;71;68;89...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.